From af8614ebb93ea48580f41bca31eaf0574f8b95e6 Mon Sep 17 00:00:00 2001 From: MarkoAT Date: Sat, 31 Dec 2022 02:45:13 +0100 Subject: [PATCH] xs2c-0.5.1 .net6 migration --- IxianS2/Meta/Config.cs | 2 +- IxianS2/Meta/Node.cs | 7 +- IxianS2/Network/StreamProcessor.cs | 2 +- IxianS2/Program.cs | 5 +- IxianS2/S2Node.csproj | 113 ++++------------------- IxianS2/Tests/TestStreamClientManager.cs | 3 +- IxianS2/packages.config | 15 --- S2Node.sln | 14 +-- 8 files changed, 36 insertions(+), 125 deletions(-) delete mode 100644 IxianS2/packages.config diff --git a/IxianS2/Meta/Config.cs b/IxianS2/Meta/Config.cs index b0fa968..f2916da 100644 --- a/IxianS2/Meta/Config.cs +++ b/IxianS2/Meta/Config.cs @@ -45,7 +45,7 @@ public class Config public static string externalIp = ""; // Read-only values - public static readonly string version = "xs2c-0.5.0b"; // S2 Node version + public static readonly string version = "xs2c-0.5.1"; // S2 Node version public static readonly string checkVersionUrl = "https://www.ixian.io/s2-update.txt"; public static readonly int checkVersionSeconds = 6 * 60 * 60; // 6 hours diff --git a/IxianS2/Meta/Node.cs b/IxianS2/Meta/Node.cs index 35c8e3b..997b765 100644 --- a/IxianS2/Meta/Node.cs +++ b/IxianS2/Meta/Node.cs @@ -305,7 +305,8 @@ static public void stop() if (maintenanceThread != null) { - maintenanceThread.Abort(); + maintenanceThread.Interrupt(); + maintenanceThread.Join(); maintenanceThread = null; } @@ -429,7 +430,7 @@ public override int getLastBlockVersion() public override bool addTransaction(Transaction tx, bool force_broadcast) { // TODO Send to peer if directly connectable - CoreProtocolMessage.broadcastProtocolMessage(new char[] { 'M', 'H' }, ProtocolMessageCode.transactionData, tx.getBytes(), null); + CoreProtocolMessage.broadcastProtocolMessage(new char[] { 'M', 'H' }, ProtocolMessageCode.transactionData2, tx.getBytes(true, true), null); PendingTransactions.addPendingLocalTransaction(tx); return true; } @@ -552,7 +553,7 @@ public static void processPendingTransactions() if (cur_time - tx_time > 40) // if the transaction is pending for over 40 seconds, resend { - CoreProtocolMessage.broadcastProtocolMessage(new char[] { 'M', 'H' }, ProtocolMessageCode.transactionData, t.getBytes(), null); + CoreProtocolMessage.broadcastProtocolMessage(new char[] { 'M', 'H' }, ProtocolMessageCode.transactionData2, t.getBytes(true, true), null); entry.addedTimestamp = cur_time; entry.confirmedNodeList.Clear(); } diff --git a/IxianS2/Network/StreamProcessor.cs b/IxianS2/Network/StreamProcessor.cs index 9c1de27..6a2c3c4 100644 --- a/IxianS2/Network/StreamProcessor.cs +++ b/IxianS2/Network/StreamProcessor.cs @@ -168,7 +168,7 @@ public static void receivedTransactionSignature(byte[] bytes, RemoteEndpoint end if (transaction.verifySignature(transaction.pubKey.pubKey, null)) { // Broadcast the transaction - CoreProtocolMessage.broadcastProtocolMessage(new char[] { 'M', 'H' }, ProtocolMessageCode.transactionData, transaction.getBytes(), null, endpoint); + CoreProtocolMessage.broadcastProtocolMessage(new char[] { 'M', 'H' }, ProtocolMessageCode.transactionData2, transaction.getBytes(true, true), null, endpoint); } return; diff --git a/IxianS2/Program.cs b/IxianS2/Program.cs index 9cf1bf2..c4cf129 100644 --- a/IxianS2/Program.cs +++ b/IxianS2/Program.cs @@ -58,6 +58,7 @@ static void checkRequiredFiles() } static void checkVCRedist() { +#pragma warning disable CA1416 // Validate platform compatibility object installed_vc_redist = Microsoft.Win32.Registry.GetValue("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\14.0\\VC\\Runtimes\\x64", "Installed", 0); object installed_vc_redist_debug = Microsoft.Win32.Registry.GetValue("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\14.0\\VC\\Runtimes\\debug\\x64", "Installed", 0); bool success = false; @@ -144,6 +145,7 @@ static void checkVCRedist() Console.ReadLine(); Environment.Exit(-1); } +#pragma warning restore CA1416 // Validate platform compatibility } static void Main(string[] args) @@ -242,7 +244,8 @@ static void onStart(string[] args) if (mainLoopThread != null) { - mainLoopThread.Abort(); + mainLoopThread.Interrupt(); + mainLoopThread.Join(); mainLoopThread = null; } diff --git a/IxianS2/S2Node.csproj b/IxianS2/S2Node.csproj index 61299ff..026120e 100644 --- a/IxianS2/S2Node.csproj +++ b/IxianS2/S2Node.csproj @@ -1,104 +1,40 @@ - - - + - Debug - AnyCPU - {F408F9F2-C3A1-4FE2-8443-6D9E251924A8} + net6.0 Exe S2 IxianS2 - v4.8 - 512 - true - - - + false x64 - true - full - false - bin\Debug\ TRACE;DEBUG;S2_BUILD - prompt - 4 - false x64 - pdbonly - true - bin\Release\ TRACE;S2_BUILD - prompt - 4 - false IxianS2.ico - - ..\packages\Portable.BouncyCastle.1.8.8\lib\net40\BouncyCastle.Crypto.dll - - - ..\packages\FluentCommandLineParser.1.4.3\lib\net35\FluentCommandLineParser.dll - - - ..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll - - - ..\packages\Open.NAT.2.1.0.0\lib\net45\Open.Nat.dll - - - ..\packages\sqlite-net-pcl.1.6.292\lib\netstandard1.1\SQLite-net.dll - - - ..\packages\SQLitePCLRaw.bundle_green.1.1.14\lib\net45\SQLitePCLRaw.batteries_green.dll - - - ..\packages\SQLitePCLRaw.bundle_green.1.1.14\lib\net45\SQLitePCLRaw.batteries_v2.dll - - - ..\packages\SQLitePCLRaw.core.1.1.14\lib\net45\SQLitePCLRaw.core.dll - - - ..\packages\SQLitePCLRaw.provider.e_sqlite3.net45.1.1.14\lib\net45\SQLitePCLRaw.provider.e_sqlite3.dll - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - + + + + + + + + + + + + + @@ -117,19 +53,4 @@ - - - - - - - - This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - - - - \ No newline at end of file diff --git a/IxianS2/Tests/TestStreamClientManager.cs b/IxianS2/Tests/TestStreamClientManager.cs index 56cb81a..9c628d6 100644 --- a/IxianS2/Tests/TestStreamClientManager.cs +++ b/IxianS2/Tests/TestStreamClientManager.cs @@ -34,7 +34,8 @@ public static void stop() // Force stopping of reconnect thread if (reconnectThread == null) return; - reconnectThread.Abort(); + reconnectThread.Interrupt(); + reconnectThread.Join(); reconnectThread = null; } diff --git a/IxianS2/packages.config b/IxianS2/packages.config deleted file mode 100644 index 7236520..0000000 --- a/IxianS2/packages.config +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/S2Node.sln b/S2Node.sln index 2a963f8..a381b71 100644 --- a/S2Node.sln +++ b/S2Node.sln @@ -1,17 +1,13 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.28307.572 +# Visual Studio Version 17 +VisualStudioVersion = 17.4.33205.214 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "S2Node", "IxianS2\S2Node.csproj", "{F408F9F2-C3A1-4FE2-8443-6D9E251924A8}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "S2Node", "IxianS2\S2Node.csproj", "{F408F9F2-C3A1-4FE2-8443-6D9E251924A8}" EndProject Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "IXICore", "..\Ixian-Core\IXICore.shproj", "{80487C64-619A-4B60-97BD-ED7670BF45B3}" EndProject Global - GlobalSection(SharedMSBuildProjectFiles) = preSolution - ..\Ixian-Core\IXICore.projitems*{80487c64-619a-4b60-97bd-ed7670bf45b3}*SharedItemsImports = 13 - ..\Ixian-Core\IXICore.projitems*{f408f9f2-c3a1-4fe2-8443-6d9e251924a8}*SharedItemsImports = 4 - EndGlobalSection GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU @@ -28,4 +24,8 @@ Global GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {97344C29-18D5-463D-AD09-4E397CAFA4B6} EndGlobalSection + GlobalSection(SharedMSBuildProjectFiles) = preSolution + ..\Ixian-Core\IXICore.projitems*{80487c64-619a-4b60-97bd-ed7670bf45b3}*SharedItemsImports = 13 + ..\Ixian-Core\IXICore.projitems*{f408f9f2-c3a1-4fe2-8443-6d9e251924a8}*SharedItemsImports = 5 + EndGlobalSection EndGlobal