diff --git a/src/NBitcoin/NBitcoin.csproj b/src/NBitcoin/NBitcoin.csproj index 2b2be5f7aa..bef92b11c4 100644 --- a/src/NBitcoin/NBitcoin.csproj +++ b/src/NBitcoin/NBitcoin.csproj @@ -1,4 +1,4 @@ - + NStratis @@ -7,7 +7,7 @@ - 4.0.0.79 + 4.0.0.80 @@ -56,4 +56,4 @@ - + \ No newline at end of file diff --git a/src/Stratis.Bitcoin.Features.Api/Stratis.Bitcoin.Features.Api.csproj b/src/Stratis.Bitcoin.Features.Api/Stratis.Bitcoin.Features.Api.csproj index fbb640079c..a5356b2ab8 100644 --- a/src/Stratis.Bitcoin.Features.Api/Stratis.Bitcoin.Features.Api.csproj +++ b/src/Stratis.Bitcoin.Features.Api/Stratis.Bitcoin.Features.Api.csproj @@ -6,7 +6,7 @@ Stratis.Bitcoin.Features.Api Library Stratis.Features.Api - 1.0.7.0 + 1.0.7.2 False library diff --git a/src/Stratis.Bitcoin.Features.BlockStore/AddressIndexing/AddressIndexer.cs b/src/Stratis.Bitcoin.Features.BlockStore/AddressIndexing/AddressIndexer.cs index cb9d4da768..0faabfba2d 100644 --- a/src/Stratis.Bitcoin.Features.BlockStore/AddressIndexing/AddressIndexer.cs +++ b/src/Stratis.Bitcoin.Features.BlockStore/AddressIndexing/AddressIndexer.cs @@ -389,7 +389,7 @@ private void SaveAll() private void AddInlineStats(StringBuilder benchLog) { - benchLog.AppendLine("AddressIndexer.Height: ".PadRight(LoggingConfiguration.ColumnLength + 1) + this.IndexerTip.Height.ToString().PadRight(9) + + benchLog.AppendLine("AddressIndexer Height".PadRight(LoggingConfiguration.ColumnLength) + $": {this.IndexerTip.Height}".PadRight(9) + "AddressCache%: " + this.addressIndexRepository.GetLoadPercentage().ToString().PadRight(8) + "OutPointCache%: " + this.outpointsRepository.GetLoadPercentage().ToString().PadRight(8) + $"Ms/block: {Math.Round(this.averageTimePerBlock.Average, 2)}"); @@ -673,7 +673,7 @@ public LastBalanceDecreaseTransactionModel GetLastBalanceDecreaseTransaction(str // Height 0 is used as a placeholder height for compacted address balance records, so ignore them if they are the only record. if (lastBalanceHeight == 0) return null; - + ChainedHeader header = this.chainIndexer.GetHeader(lastBalanceHeight); if (header == null) diff --git a/src/Stratis.Bitcoin.Features.BlockStore/Stratis.Bitcoin.Features.BlockStore.csproj b/src/Stratis.Bitcoin.Features.BlockStore/Stratis.Bitcoin.Features.BlockStore.csproj index 8fda23fb0b..0bf94053f8 100644 --- a/src/Stratis.Bitcoin.Features.BlockStore/Stratis.Bitcoin.Features.BlockStore.csproj +++ b/src/Stratis.Bitcoin.Features.BlockStore/Stratis.Bitcoin.Features.BlockStore.csproj @@ -14,7 +14,7 @@ false false false - 1.0.7.0 + 1.0.7.2 False Stratis Group Ltd. diff --git a/src/Stratis.Bitcoin.Features.ColdStaking/Stratis.Bitcoin.Features.ColdStaking.csproj b/src/Stratis.Bitcoin.Features.ColdStaking/Stratis.Bitcoin.Features.ColdStaking.csproj index f40ea5b0d9..d235289514 100644 --- a/src/Stratis.Bitcoin.Features.ColdStaking/Stratis.Bitcoin.Features.ColdStaking.csproj +++ b/src/Stratis.Bitcoin.Features.ColdStaking/Stratis.Bitcoin.Features.ColdStaking.csproj @@ -7,7 +7,7 @@ false false false - 1.0.7.0 + 1.0.7.2 False Stratis Group Ltd. diff --git a/src/Stratis.Bitcoin.Features.Consensus/Stratis.Bitcoin.Features.Consensus.csproj b/src/Stratis.Bitcoin.Features.Consensus/Stratis.Bitcoin.Features.Consensus.csproj index 545ff84c31..d91df8d79c 100644 --- a/src/Stratis.Bitcoin.Features.Consensus/Stratis.Bitcoin.Features.Consensus.csproj +++ b/src/Stratis.Bitcoin.Features.Consensus/Stratis.Bitcoin.Features.Consensus.csproj @@ -14,7 +14,7 @@ false false false - 1.0.7.0 + 1.0.7.2 False Stratis Group Ltd. @@ -28,7 +28,7 @@ - + diff --git a/src/Stratis.Bitcoin.Features.MemoryPool/Stratis.Bitcoin.Features.MemoryPool.csproj b/src/Stratis.Bitcoin.Features.MemoryPool/Stratis.Bitcoin.Features.MemoryPool.csproj index 7d61048609..7830b82862 100644 --- a/src/Stratis.Bitcoin.Features.MemoryPool/Stratis.Bitcoin.Features.MemoryPool.csproj +++ b/src/Stratis.Bitcoin.Features.MemoryPool/Stratis.Bitcoin.Features.MemoryPool.csproj @@ -14,7 +14,7 @@ false false false - 1.0.7.0 + 1.0.7.2 False library Stratis Group Ltd. diff --git a/src/Stratis.Bitcoin.Features.Miner/Stratis.Bitcoin.Features.Miner.csproj b/src/Stratis.Bitcoin.Features.Miner/Stratis.Bitcoin.Features.Miner.csproj index cb2d71e264..b35cc7dc35 100644 --- a/src/Stratis.Bitcoin.Features.Miner/Stratis.Bitcoin.Features.Miner.csproj +++ b/src/Stratis.Bitcoin.Features.Miner/Stratis.Bitcoin.Features.Miner.csproj @@ -1,4 +1,4 @@ - + Stratis Bitcoin Features Miner @@ -14,7 +14,7 @@ false false false - 1.0.7.0 + 1.0.7.2 False Stratis Group Ltd. @@ -47,4 +47,4 @@ - + \ No newline at end of file diff --git a/src/Stratis.Bitcoin.Features.Notifications/Stratis.Bitcoin.Features.Notifications.csproj b/src/Stratis.Bitcoin.Features.Notifications/Stratis.Bitcoin.Features.Notifications.csproj index 96f8a641c2..5b8218e91c 100644 --- a/src/Stratis.Bitcoin.Features.Notifications/Stratis.Bitcoin.Features.Notifications.csproj +++ b/src/Stratis.Bitcoin.Features.Notifications/Stratis.Bitcoin.Features.Notifications.csproj @@ -14,7 +14,7 @@ false false false - 1.0.7.0 + 1.0.7.2 False Stratis Group Ltd. diff --git a/src/Stratis.Bitcoin.Features.PoA.IntegrationTests.Common/Stratis.Bitcoin.Features.PoA.IntegrationTests.Common.csproj b/src/Stratis.Bitcoin.Features.PoA.IntegrationTests.Common/Stratis.Bitcoin.Features.PoA.IntegrationTests.Common.csproj index 91aea9c16d..1353f35326 100644 --- a/src/Stratis.Bitcoin.Features.PoA.IntegrationTests.Common/Stratis.Bitcoin.Features.PoA.IntegrationTests.Common.csproj +++ b/src/Stratis.Bitcoin.Features.PoA.IntegrationTests.Common/Stratis.Bitcoin.Features.PoA.IntegrationTests.Common.csproj @@ -13,7 +13,7 @@ false false false - 1.0.6.4 + 1.0.7.2 False diff --git a/src/Stratis.Bitcoin.Features.PoA/PoAMiner.cs b/src/Stratis.Bitcoin.Features.PoA/PoAMiner.cs index 09c55c5566..bbcc6fd318 100644 --- a/src/Stratis.Bitcoin.Features.PoA/PoAMiner.cs +++ b/src/Stratis.Bitcoin.Features.PoA/PoAMiner.cs @@ -7,6 +7,7 @@ using Microsoft.Extensions.Logging; using NBitcoin; using Stratis.Bitcoin.AsyncWork; +using Stratis.Bitcoin.Configuration.Logging; using Stratis.Bitcoin.Connection; using Stratis.Bitcoin.Consensus; using Stratis.Bitcoin.Consensus.Validators; @@ -400,8 +401,7 @@ private void AddVotingData(BlockTemplate blockTemplate) [NoTrace] private void AddComponentStats(StringBuilder log) { - log.AppendLine(); - log.AppendLine("======PoA Miner======"); + log.AppendLine(">> Miner"); if (this.ibdState.IsInitialBlockDownload()) { @@ -461,8 +461,8 @@ private void AddComponentStats(StringBuilder log) log.Append("..."); log.AppendLine(); - log.AppendLine($"Block producers hits : {hitCount} of {maxDepth}({(((float)hitCount / (float)maxDepth)).ToString("P2")})"); - log.AppendLine($"Block producers idle time : {TimeSpan.FromSeconds(this.network.ConsensusOptions.TargetSpacingSeconds * (maxDepth - hitCount)).ToString(@"hh\:mm\:ss")}"); + log.AppendLine($"Miner hits".PadRight(LoggingConfiguration.ColumnLength) + $": {hitCount} of {maxDepth}({(((float)hitCount / (float)maxDepth)).ToString("P2")})"); + log.AppendLine($"Miner idle time".PadRight(LoggingConfiguration.ColumnLength) + $": { TimeSpan.FromSeconds(this.network.ConsensusOptions.TargetSpacingSeconds * (maxDepth - hitCount)).ToString(@"hh\:mm\:ss")}"); log.AppendLine(); } diff --git a/src/Stratis.Bitcoin.Features.PoA/Stratis.Bitcoin.Features.PoA.csproj b/src/Stratis.Bitcoin.Features.PoA/Stratis.Bitcoin.Features.PoA.csproj index 768ee064c3..3985911cb4 100644 --- a/src/Stratis.Bitcoin.Features.PoA/Stratis.Bitcoin.Features.PoA.csproj +++ b/src/Stratis.Bitcoin.Features.PoA/Stratis.Bitcoin.Features.PoA.csproj @@ -14,7 +14,7 @@ false false false - 1.0.7.0 + 1.0.7.2 False Stratis Group Ltd. diff --git a/src/Stratis.Bitcoin.Features.RPC/Stratis.Bitcoin.Features.RPC.csproj b/src/Stratis.Bitcoin.Features.RPC/Stratis.Bitcoin.Features.RPC.csproj index cbbefd112e..6cf6fe76e4 100644 --- a/src/Stratis.Bitcoin.Features.RPC/Stratis.Bitcoin.Features.RPC.csproj +++ b/src/Stratis.Bitcoin.Features.RPC/Stratis.Bitcoin.Features.RPC.csproj @@ -14,7 +14,7 @@ false false false - 1.0.7.0 + 1.0.7.2 False Stratis Group Ltd. diff --git a/src/Stratis.Bitcoin.Features.SmartContracts/Stratis.Bitcoin.Features.SmartContracts.csproj b/src/Stratis.Bitcoin.Features.SmartContracts/Stratis.Bitcoin.Features.SmartContracts.csproj index a584b13db3..83303d2132 100644 --- a/src/Stratis.Bitcoin.Features.SmartContracts/Stratis.Bitcoin.Features.SmartContracts.csproj +++ b/src/Stratis.Bitcoin.Features.SmartContracts/Stratis.Bitcoin.Features.SmartContracts.csproj @@ -2,7 +2,7 @@ netcoreapp3.1 - 1.0.7.1 + 1.0.7.2 Stratis Group Ltd. Stratis.Features.SmartContracts Stratis.Features.SmartContracts diff --git a/src/Stratis.Bitcoin.Features.Wallet/Stratis.Bitcoin.Features.Wallet.csproj b/src/Stratis.Bitcoin.Features.Wallet/Stratis.Bitcoin.Features.Wallet.csproj index e5428ae22b..c1a1de4feb 100644 --- a/src/Stratis.Bitcoin.Features.Wallet/Stratis.Bitcoin.Features.Wallet.csproj +++ b/src/Stratis.Bitcoin.Features.Wallet/Stratis.Bitcoin.Features.Wallet.csproj @@ -14,7 +14,7 @@ false false false - 1.0.7.0 + 1.0.7.2 False Stratis Group Ltd. diff --git a/src/Stratis.Bitcoin.Features.Wallet/WalletFeature.cs b/src/Stratis.Bitcoin.Features.Wallet/WalletFeature.cs index cce70ce1a3..3fa56db638 100644 --- a/src/Stratis.Bitcoin.Features.Wallet/WalletFeature.cs +++ b/src/Stratis.Bitcoin.Features.Wallet/WalletFeature.cs @@ -100,8 +100,6 @@ private void AddInlineStats(StringBuilder log) log.AppendLine("Wallet Height".PadRight(LoggingConfiguration.ColumnLength) + $": {this.walletManager.WalletTipHeight}".PadRight(10) + $"(Hash: {this.walletManager.WalletTipHash})"); else log.AppendLine("Wallet Height".PadRight(LoggingConfiguration.ColumnLength) + ": No Wallet"); - - log.AppendLine(); } private void AddComponentStats(StringBuilder log) diff --git a/src/Stratis.Bitcoin.IntegrationTests.Common/Stratis.Bitcoin.IntegrationTests.Common.csproj b/src/Stratis.Bitcoin.IntegrationTests.Common/Stratis.Bitcoin.IntegrationTests.Common.csproj index 06ec67387d..01aba0922f 100644 --- a/src/Stratis.Bitcoin.IntegrationTests.Common/Stratis.Bitcoin.IntegrationTests.Common.csproj +++ b/src/Stratis.Bitcoin.IntegrationTests.Common/Stratis.Bitcoin.IntegrationTests.Common.csproj @@ -13,7 +13,7 @@ false false false - 1.0.7 + 1.0.7.2 False diff --git a/src/Stratis.Bitcoin.Networks/Stratis.Bitcoin.Networks.csproj b/src/Stratis.Bitcoin.Networks/Stratis.Bitcoin.Networks.csproj index bea2197d42..c2fa5cc617 100644 --- a/src/Stratis.Bitcoin.Networks/Stratis.Bitcoin.Networks.csproj +++ b/src/Stratis.Bitcoin.Networks/Stratis.Bitcoin.Networks.csproj @@ -16,7 +16,7 @@ false 1.0.7.0 1.0.7.0 - 1.0.7.0 + 1.0.7.2 False Stratis Group Ltd. diff --git a/src/Stratis.Bitcoin.Tests.Common/Stratis.Bitcoin.Tests.Common.csproj b/src/Stratis.Bitcoin.Tests.Common/Stratis.Bitcoin.Tests.Common.csproj index 9145cf8ca0..04f8cb9104 100644 --- a/src/Stratis.Bitcoin.Tests.Common/Stratis.Bitcoin.Tests.Common.csproj +++ b/src/Stratis.Bitcoin.Tests.Common/Stratis.Bitcoin.Tests.Common.csproj @@ -13,7 +13,7 @@ false false false - 1.0.7 + 1.0.7.2 False diff --git a/src/Stratis.Bitcoin.Tests/PackagesAndVersions/PackagesAndVersionsTests.cs b/src/Stratis.Bitcoin.Tests/PackagesAndVersions/PackagesAndVersionsTests.cs new file mode 100644 index 0000000000..e4c1c3862e --- /dev/null +++ b/src/Stratis.Bitcoin.Tests/PackagesAndVersions/PackagesAndVersionsTests.cs @@ -0,0 +1,196 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.IO.Compression; +using System.Linq; +using System.Net; +using System.Xml; +using Microsoft.Build.Construction; +using Xunit; + +namespace Stratis.Bitcoin.Tests.PackagesAndVersions +{ + public class PackagesAndVersionsTests + { + [Fact] + public void EnsureVersionsBumpedWhenChangingPublishedPackages() + { + // 1) Read solution file and get all projects with package information. + // 2) Retrieve the package from NuGet if not retrieved already + // 3) If the source code is different and same version then this is an error. + + var modifiedPackages = new List(); + + string sourceFolder = AppDomain.CurrentDomain.BaseDirectory; + for (int i = 0; i < 5; i++) + sourceFolder = Directory.GetParent(sourceFolder).ToString(); + + string solutionFilePath = Directory.EnumerateFiles(sourceFolder, "*.sln").First(); + SolutionFile solutionFile = SolutionFile.Parse(solutionFilePath); + HashSet extra = new HashSet() { "NBitcoin", "FodyNlogAdapter" }; + + var projectsByPath = solutionFile.ProjectsByGuid + .Where(p => p.Value.ProjectName.StartsWith("Stratis.") || extra.Contains(p.Value.ProjectName)) + .ToDictionary(p => p.Value.AbsolutePath, p => p.Value); + var projectFiles = projectsByPath.ToDictionary(p => p.Key, p => { XmlDocument doc = new XmlDocument(); doc.Load(p.Key); return doc; }); + var referencedVersions = projectFiles.ToDictionary(p => p.Key, p => p.Value.SelectSingleNode("Project/PropertyGroup/Version")?.InnerText); + var projectsToCheck = new List(projectsByPath.Keys); + + while (projectsToCheck.Count > 0) + { + string projectFolder = projectsToCheck.First(); + projectsToCheck.RemoveAt(0); + + ProjectInSolution project = projectsByPath[projectFolder]; + + // Read project file. + XmlDocument doc = projectFiles[projectFolder]; + + string name = doc.SelectSingleNode("Project/PropertyGroup/PackageId")?.InnerText; + if (name == null) + continue; + + string version = doc.SelectSingleNode("Project/PropertyGroup/Version")?.InnerText; + if (version == null) + continue; + + if (version.EndsWith(".0")) + version = version.Substring(0, version.Length - 2); + + // Check the referenced projects first. + var references = new List(); + foreach (XmlNode x in doc.SelectNodes("/Project/ItemGroup/ProjectReference")) + { + string includePath = x.Attributes["Include"].Value; + string referencedProject = Path.GetFullPath(Path.Combine(Path.GetDirectoryName(projectFolder), includePath)); + + if (projectsToCheck.Contains(referencedProject)) + { + references.Add(referencedProject); + projectsToCheck.Remove(referencedProject); + } + } + + if (references.Count > 0) + { + projectsToCheck.InsertRange(0, references); + projectsToCheck.Add(projectFolder); + continue; + } + + string targetName = $"{name.ToLower()}.{version}-nuget.symbols"; + string targetFolder = Path.Combine(Path.GetDirectoryName(projectFolder), "bin", "Release"); + string targetPath = Path.Combine(targetFolder, targetName); + if (!Directory.Exists(targetPath)) + { + if (!Directory.Exists(targetFolder)) + Directory.CreateDirectory(targetFolder); + + string targetFile = Path.Combine(projectFolder, $"{targetPath}.nupkg"); + if (!File.Exists(targetFile)) + { + string url = $"https://www.nuget.org/api/v2/package/{name}/{version}"; + // Only if its on NuGet too. + using (var client = new WebClient()) + { + try + { + client.DownloadFile(url, targetFile); + } + catch (Exception) + { + if (File.Exists(targetFile)) + File.Delete(targetFile); + + continue; + } + } + } + + ZipFile.ExtractToDirectory(targetFile, targetPath); + } + + // Compare source with files from NuGet. + string packageSource = Path.Combine(targetPath, "src", project.ProjectName); + if (Directory.Exists(packageSource) && DirectoryEquals(packageSource, Path.GetDirectoryName(projectFolder))) + { + // Even though the project file may be unchanged the references could be referring to different versions. + + // Load the NUSPEC file from the package. + string nuspecFile = Path.Combine(targetPath, $"{name}.nuspec"); + XmlDocument doc2 = new XmlDocument(); + doc2.Load(nuspecFile); + + bool versionsMatch = true; + foreach (XmlNode x in doc.SelectNodes("/Project/ItemGroup/ProjectReference")) + { + string includePath = x.Attributes["Include"].Value; + string includeFullPath = Path.GetFullPath(Path.Combine(Path.GetDirectoryName(projectFolder), includePath)); + + XmlDocument doc3 = projectFiles[includeFullPath]; + string name3 = doc3.SelectSingleNode("Project/PropertyGroup/PackageId")?.InnerText; + + XmlNode depNode = doc2.SelectSingleNode($"//*[name()='dependency' and @id='{name3}']"); + string cmpVersion = depNode.Attributes["version"].Value; + + if (cmpVersion != referencedVersions[includeFullPath]) + { + versionsMatch = false; + break; + } + } + + if (versionsMatch) + continue; + } + + modifiedPackages.Add(project.ProjectName); + referencedVersions[projectFolder] = "mismatch"; + } + + Assert.Empty(modifiedPackages); + } + + static bool DirectoryEquals(string directory1, string directory2) + { + foreach (string fileName1 in Directory.EnumerateFiles(directory1)) + { + string fileName2 = Path.Combine(directory2, Path.GetFileName(fileName1)); + if (!FileEquals(fileName1, fileName2)) + return false; + } + + foreach (string subFolder in Directory.EnumerateDirectories(directory1)) + { + string directoryName = Path.GetFileName(subFolder); + if (!DirectoryEquals(subFolder, Path.Combine(directory2, directoryName))) + return false; + } + + return true; + } + + static bool FileEquals(string fileName1, string fileName2) + { + try + { + IEnumerable source = File.ReadLines(fileName2); + + foreach (string line in File.ReadLines(fileName1)) + { + if (source.Take(1).FirstOrDefault() != line) + return false; + + source = source.Skip(1); + continue; + } + + return source.Take(1).FirstOrDefault() == null; + } + catch (Exception) + { + return false; + } + } + } +} diff --git a/src/Stratis.Bitcoin.Tests/Stratis.Bitcoin.Tests.csproj b/src/Stratis.Bitcoin.Tests/Stratis.Bitcoin.Tests.csproj index d8d808cc56..934cf0b6b8 100644 --- a/src/Stratis.Bitcoin.Tests/Stratis.Bitcoin.Tests.csproj +++ b/src/Stratis.Bitcoin.Tests/Stratis.Bitcoin.Tests.csproj @@ -28,6 +28,7 @@ + all diff --git a/src/Stratis.Bitcoin/Connection/ConnectionManager.cs b/src/Stratis.Bitcoin/Connection/ConnectionManager.cs index 5ece69e57e..bc0d6021c3 100644 --- a/src/Stratis.Bitcoin/Connection/ConnectionManager.cs +++ b/src/Stratis.Bitcoin/Connection/ConnectionManager.cs @@ -316,6 +316,7 @@ void AddPeerInfo(StringBuilder peerBuilder, INetworkPeer peer) int inbound = this.ConnectedPeers.Count(x => x.Inbound); + builder.AppendLine(); builder.AppendLine($">> Connections (In:{inbound}) (Out:{this.ConnectedPeers.Count() - inbound})"); builder.AppendLine("Data Transfer".PadRight(LoggingConfiguration.ColumnLength, ' ') + $": Received: {totalRead.BytesToMegaBytes()} MB Sent: {totalWritten.BytesToMegaBytes()} MB"); diff --git a/src/Stratis.Bitcoin/Properties/AssemblyInfo.cs b/src/Stratis.Bitcoin/Properties/AssemblyInfo.cs index 78a5cc4f47..a57b1d640e 100644 --- a/src/Stratis.Bitcoin/Properties/AssemblyInfo.cs +++ b/src/Stratis.Bitcoin/Properties/AssemblyInfo.cs @@ -32,6 +32,6 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.7.0")] -[assembly: AssemblyFileVersion("1.0.7.0")] +[assembly: AssemblyVersion("1.0.7.2")] +[assembly: AssemblyFileVersion("1.0.7.2")] [assembly: InternalsVisibleTo("Stratis.Bitcoin.Tests")] \ No newline at end of file diff --git a/src/Stratis.Bitcoin/Stratis.Bitcoin.csproj b/src/Stratis.Bitcoin/Stratis.Bitcoin.csproj index be9871679d..292f17b713 100644 --- a/src/Stratis.Bitcoin/Stratis.Bitcoin.csproj +++ b/src/Stratis.Bitcoin/Stratis.Bitcoin.csproj @@ -14,7 +14,7 @@ false false false - 1.0.7.0 + 1.0.7.2 False ..\Stratis.ruleset Stratis Group Ltd. @@ -44,7 +44,7 @@ - + diff --git a/src/Stratis.CirrusDnsD/Program.cs b/src/Stratis.CirrusDnsD/Program.cs index 4ec582b0f1..b3a5fc1d2f 100644 --- a/src/Stratis.CirrusDnsD/Program.cs +++ b/src/Stratis.CirrusDnsD/Program.cs @@ -4,6 +4,7 @@ using Stratis.Bitcoin; using Stratis.Bitcoin.Builder; using Stratis.Bitcoin.Configuration; +using Stratis.Bitcoin.Consensus; using Stratis.Bitcoin.Features.Api; using Stratis.Bitcoin.Features.BlockStore; using Stratis.Bitcoin.Features.Dns; @@ -12,8 +13,10 @@ using Stratis.Bitcoin.Features.SmartContracts; using Stratis.Bitcoin.Features.SmartContracts.PoA; using Stratis.Bitcoin.Features.SmartContracts.Wallet; +using Stratis.Bitcoin.Networks; using Stratis.Bitcoin.Utilities; using Stratis.Features.Collateral; +using Stratis.Features.Collateral.CounterChain; using Stratis.Features.SQLiteWalletRepository; using Stratis.Sidechains.Networks; @@ -67,9 +70,11 @@ public static async Task Main(string[] args) private static IFullNode GetSideChainFullNode(NodeSettings nodeSettings) { - IFullNode node = new FullNodeBuilder() - .UseNodeSettings(nodeSettings) - .UseBlockStore() + DbType dbType = nodeSettings.GetDbType(); + + IFullNodeBuilder nodeBuilder = new FullNodeBuilder() + .UseNodeSettings(nodeSettings, dbType) + .UseBlockStore(dbType) .UseMempool() .AddSmartContracts(options => { @@ -77,16 +82,20 @@ private static IFullNode GetSideChainFullNode(NodeSettings nodeSettings) options.UsePoAWhitelistedContracts(); }) .AddPoAFeature() - .UsePoAConsensus() + .UsePoAConsensus(dbType) .CheckCollateralCommitment() + + // This needs to be set so that we can check the magic bytes during the Strat to Strax changeover. + // Perhaps we can introduce a block height check rather? + .SetCounterChainNetwork(StraxNetwork.MainChainNetworks[nodeSettings.Network.NetworkType]()) + .UseSmartContractWallet() .AddSQLiteWalletRepository() .UseApi() .AddRPC() - .UseDns() - .Build(); + .UseDns(); - return node; + return nodeBuilder.Build(); } private static IFullNode GetDnsNode(NodeSettings nodeSettings) diff --git a/src/Stratis.CirrusDnsD/Stratis.CirrusDnsD.csproj b/src/Stratis.CirrusDnsD/Stratis.CirrusDnsD.csproj index fd8778f4db..dc3e303e15 100644 --- a/src/Stratis.CirrusDnsD/Stratis.CirrusDnsD.csproj +++ b/src/Stratis.CirrusDnsD/Stratis.CirrusDnsD.csproj @@ -23,6 +23,7 @@ + diff --git a/src/Stratis.Features.FederatedPeg/TargetChain/CrossChainTransferStore.cs b/src/Stratis.Features.FederatedPeg/TargetChain/CrossChainTransferStore.cs index bf18e67163..8a09627d14 100644 --- a/src/Stratis.Features.FederatedPeg/TargetChain/CrossChainTransferStore.cs +++ b/src/Stratis.Features.FederatedPeg/TargetChain/CrossChainTransferStore.cs @@ -1435,7 +1435,7 @@ public static bool IsMempoolErrorRecoverable(MempoolError mempoolError) private void AddComponentStats(StringBuilder benchLog) { - benchLog.AppendLine("====== Cross Chain Transfer Store ======"); + benchLog.AppendLine(">> Cross Chain Transfer Store"); benchLog.AppendLine("Height".PadRight(LoggingConfiguration.ColumnLength) + $": {this.TipHashAndHeight.Height} [{this.TipHashAndHeight.HashBlock}]"); benchLog.AppendLine("NextDepositHeight".PadRight(LoggingConfiguration.ColumnLength) + $": {this.NextMatureDepositHeight}"); benchLog.AppendLine("Partial Txs".PadRight(LoggingConfiguration.ColumnLength) + $": {GetTransferCountByStatus(CrossChainTransferStatus.Partial)}"); diff --git a/src/Stratis.Features.FederatedPeg/Wallet/FederationWalletManager.cs b/src/Stratis.Features.FederatedPeg/Wallet/FederationWalletManager.cs index 5b113b3b5e..3cd53a6d5f 100644 --- a/src/Stratis.Features.FederatedPeg/Wallet/FederationWalletManager.cs +++ b/src/Stratis.Features.FederatedPeg/Wallet/FederationWalletManager.cs @@ -1298,17 +1298,17 @@ private void AddInlineStats(StringBuilder benchLogs) string hash = this.Wallet?.LastBlockSyncedHash == null ? "N/A" : this.Wallet.LastBlockSyncedHash.ToString(); string height = this.Wallet?.LastBlockSyncedHeight == null ? "N/A" : this.Wallet.LastBlockSyncedHeight.ToString(); - benchLogs.AppendLine("Fed.Wallet.Height: ".PadRight(LoggingConfiguration.ColumnLength + 1) + height.ToString().PadRight(8) + " Fed.Wallet.Hash: ".PadRight(LoggingConfiguration.ColumnLength - 1) + hash); + benchLogs.AppendLine("Fed.Wallet.Height".PadRight(LoggingConfiguration.ColumnLength) + $": {height.PadRight(10)} (Hash : {hash})"); } private void AddComponentStats(StringBuilder benchLog) { - benchLog.AppendLine("====== Federation Wallet ======"); + benchLog.AppendLine(">> Federation Wallet"); (Money ConfirmedAmount, Money UnConfirmedAmount) = GetSpendableAmount(); - benchLog.AppendLine("Federation Wallet: ".PadRight(LoggingConfiguration.ColumnLength) - + " Confirmed balance: " + ConfirmedAmount.ToString().PadRight(LoggingConfiguration.ColumnLength) + benchLog.AppendLine("Federation Wallet".PadRight(LoggingConfiguration.ColumnLength) + + ": Confirmed balance: " + ConfirmedAmount.ToString().PadRight(LoggingConfiguration.ColumnLength) + " Reserved for withdrawals: " + UnConfirmedAmount.ToString().PadRight(LoggingConfiguration.ColumnLength) + " Federation Status: " + (this.isFederationActive ? "Active" : "Inactive")); benchLog.AppendLine(); diff --git a/src/Stratis.Features.SQLiteWalletRepository/Stratis.Features.SQLiteWalletRepository.csproj b/src/Stratis.Features.SQLiteWalletRepository/Stratis.Features.SQLiteWalletRepository.csproj index ab252914ad..0aabe7d467 100644 --- a/src/Stratis.Features.SQLiteWalletRepository/Stratis.Features.SQLiteWalletRepository.csproj +++ b/src/Stratis.Features.SQLiteWalletRepository/Stratis.Features.SQLiteWalletRepository.csproj @@ -14,7 +14,7 @@ false false false - 1.0.7.0 + 1.0.7.2 False Stratis Group Ltd. diff --git a/src/Stratis.Sidechains.Networks/CirrusMain.cs b/src/Stratis.Sidechains.Networks/CirrusMain.cs index d37603dfea..f6f688fd30 100644 --- a/src/Stratis.Sidechains.Networks/CirrusMain.cs +++ b/src/Stratis.Sidechains.Networks/CirrusMain.cs @@ -267,7 +267,8 @@ public CirrusMain() { 1300000, new CheckpointInfo(new uint256("0x512c19a8245316b4d3b13513c7901f41842846f539f668ca4ac349daaab6dc20")) }, { 1400000, new CheckpointInfo(new uint256("0xbfd4a96a6c5250f18bf7c586761256fa5f8753ffa10b24160f0648a452823a95")) }, { 1500000, new CheckpointInfo(new uint256("0x2a1602877a5231997654bae975223762ee636be2f371cb444b2d3fb564e6989e")) }, - { 1750000, new CheckpointInfo(new uint256("0x58c96a878efeeffea1b1924b61eed627687900e01588ffaa2f4a161973f01abf")) } + { 1750000, new CheckpointInfo(new uint256("0x58c96a878efeeffea1b1924b61eed627687900e01588ffaa2f4a161973f01abf")) }, + { 1850000, new CheckpointInfo(new uint256("0x6e2590bd9a8eaab25b236c0c9ac314abec70b18aa053b96c9257f2356dec8314")) }, }; this.DNSSeeds = new List