diff --git a/src/FederationSetup/FederationSetup.csproj b/src/FederationSetup/FederationSetup.csproj
index eeff31186a..e7e6dee070 100644
--- a/src/FederationSetup/FederationSetup.csproj
+++ b/src/FederationSetup/FederationSetup.csproj
@@ -3,7 +3,7 @@
Exe
netcoreapp3.1
- 1.0.6.0
+ 1.0.6.1
Stratis Group Ltd.
diff --git a/src/FodyNlogAdapter/FodyNlogAdapter.csproj b/src/FodyNlogAdapter/FodyNlogAdapter.csproj
index 13dbcc0bd9..43d8d4b5cd 100644
--- a/src/FodyNlogAdapter/FodyNlogAdapter.csproj
+++ b/src/FodyNlogAdapter/FodyNlogAdapter.csproj
@@ -3,7 +3,7 @@
netcoreapp3.1
FodyNlogAdapter
- 1.0.6.0
+ 1.0.6.1
False
Stratis Group Ltd.
Stratis.Utils.FodyNlogAdapter
diff --git a/src/Stratis.Bitcoin.Cli/Stratis.Bitcoin.Cli.csproj b/src/Stratis.Bitcoin.Cli/Stratis.Bitcoin.Cli.csproj
index 7c0dd4aafd..be9cf911e6 100644
--- a/src/Stratis.Bitcoin.Cli/Stratis.Bitcoin.Cli.csproj
+++ b/src/Stratis.Bitcoin.Cli/Stratis.Bitcoin.Cli.csproj
@@ -3,7 +3,7 @@
Exe
netcoreapp3.1
- 1.0.6.0
+ 1.0.6.1
Stratis Group Ltd.
Stratis Group Ltd.
diff --git a/src/Stratis.Bitcoin.Features.Api/LoggingActionFilter.cs b/src/Stratis.Bitcoin.Features.Api/LoggingActionFilter.cs
index f0b883f72a..3f9241024f 100644
--- a/src/Stratis.Bitcoin.Features.Api/LoggingActionFilter.cs
+++ b/src/Stratis.Bitcoin.Features.Api/LoggingActionFilter.cs
@@ -12,7 +12,7 @@ namespace Stratis.Bitcoin.Features.Api
///
/// An asynchronous action filter whose role is to log details from the Http requests to the API.
///
- ///
+ ///
public class LoggingActionFilter : IAsyncActionFilter
{
private readonly ILogger logger;
@@ -34,7 +34,7 @@ public async Task OnActionExecutionAsync(ActionExecutingContext context, ActionE
body = string.Join(Environment.NewLine, arguments.Values);
}
- this.logger.LogDebug($"Received {request.Method} {request.GetDisplayUrl()}. Body: '{body}'");
+ this.logger.LogDebug("Received {0} {1}. Body: '{2}'", request.Method, request.GetDisplayUrl(), body);
await next();
}
}
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 f036ce073f..9e3bc3f103 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.6.0
+ 1.0.6.1
False
library
diff --git a/src/Stratis.Bitcoin.Features.BlockStore/Pruning/PruneBlockStoreService.cs b/src/Stratis.Bitcoin.Features.BlockStore/Pruning/PruneBlockStoreService.cs
index c967c124ce..9cc50aa3f9 100644
--- a/src/Stratis.Bitcoin.Features.BlockStore/Pruning/PruneBlockStoreService.cs
+++ b/src/Stratis.Bitcoin.Features.BlockStore/Pruning/PruneBlockStoreService.cs
@@ -97,7 +97,7 @@ public void PruneBlocks()
startFrom = startFrom.Previous;
}
- this.logger.LogDebug($"{chainedHeadersToDelete.Count} blocks will be pruned.");
+ this.logger.LogDebug("{0} blocks will be pruned.", chainedHeadersToDelete.Count);
ChainedHeader prunedTip = chainedHeadersToDelete.First();
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 70813edfb0..e86868c1c9 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.6.0
+ 1.0.6.1
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 4c098e8da2..93f80d16f0 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.6.0
+ 1.0.6.1
False
Stratis Group Ltd.
diff --git a/src/Stratis.Bitcoin.Features.Consensus/ProvenBlockHeaders/ProvenBlockHeaderStore.cs b/src/Stratis.Bitcoin.Features.Consensus/ProvenBlockHeaders/ProvenBlockHeaderStore.cs
index bf82d31ccd..08b77d11b3 100644
--- a/src/Stratis.Bitcoin.Features.Consensus/ProvenBlockHeaders/ProvenBlockHeaderStore.cs
+++ b/src/Stratis.Bitcoin.Features.Consensus/ProvenBlockHeaders/ProvenBlockHeaderStore.cs
@@ -352,7 +352,7 @@ private void AddComponentStats(StringBuilder log)
log.AppendLine("======ProvenBlockHeaderStore======");
log.AppendLine($"Batch Size: {Math.Round(totalBatchInMb, 2)} Mb ({count} headers)");
log.AppendLine($"Cache Size: {Math.Round(totalCacheInMb, 2)}/{Math.Round(totalMaxCacheInMb, 2)} MB");
-
+ log.AppendLine();
}
///
diff --git a/src/Stratis.Bitcoin.Features.Consensus/Rules/CommonRules/StraxCoinviewRule.cs b/src/Stratis.Bitcoin.Features.Consensus/Rules/CommonRules/StraxCoinviewRule.cs
index 64f91329b8..43dcd257c9 100644
--- a/src/Stratis.Bitcoin.Features.Consensus/Rules/CommonRules/StraxCoinviewRule.cs
+++ b/src/Stratis.Bitcoin.Features.Consensus/Rules/CommonRules/StraxCoinviewRule.cs
@@ -101,7 +101,7 @@ protected override void AllowSpend(TxOut prevOut, Transaction tx)
}
// TODO: This is the wrong destination message. Should be output.scriptpubkey?
- this.Logger.LogDebug($"Reward distribution transaction validated in consensus, spending to '{prevOut.ScriptPubKey}'.");
+ this.Logger.LogDebug("Reward distribution transaction validated in consensus, spending to '{0}'.", prevOut.ScriptPubKey);
}
// Otherwise allow the spend (do nothing).
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 9e3f4eda96..df4c48a244 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.6.0
+ 1.0.6.1
False
Stratis Group Ltd.
diff --git a/src/Stratis.Bitcoin.Features.Dns/Stratis.Bitcoin.Features.Dns.csproj b/src/Stratis.Bitcoin.Features.Dns/Stratis.Bitcoin.Features.Dns.csproj
index 970501bd2c..0980f0c2c2 100644
--- a/src/Stratis.Bitcoin.Features.Dns/Stratis.Bitcoin.Features.Dns.csproj
+++ b/src/Stratis.Bitcoin.Features.Dns/Stratis.Bitcoin.Features.Dns.csproj
@@ -14,7 +14,7 @@
false
false
false
- 1.0.6.0
+ 1.0.6.1
False
Stratis Group Ltd.
diff --git a/src/Stratis.Bitcoin.Features.LightWallet/Stratis.Bitcoin.Features.LightWallet.csproj b/src/Stratis.Bitcoin.Features.LightWallet/Stratis.Bitcoin.Features.LightWallet.csproj
index cbaee9531c..6e4a4393eb 100644
--- a/src/Stratis.Bitcoin.Features.LightWallet/Stratis.Bitcoin.Features.LightWallet.csproj
+++ b/src/Stratis.Bitcoin.Features.LightWallet/Stratis.Bitcoin.Features.LightWallet.csproj
@@ -7,7 +7,7 @@
false
false
false
- 1.0.6.0
+ 1.0.6.1
False
Stratis Group Ltd.
diff --git a/src/Stratis.Bitcoin.Features.MemoryPool/MempoolFeature.cs b/src/Stratis.Bitcoin.Features.MemoryPool/MempoolFeature.cs
index 4c90431336..d21770e863 100644
--- a/src/Stratis.Bitcoin.Features.MemoryPool/MempoolFeature.cs
+++ b/src/Stratis.Bitcoin.Features.MemoryPool/MempoolFeature.cs
@@ -11,7 +11,6 @@
using Stratis.Bitcoin.Features.Consensus;
using Stratis.Bitcoin.Features.MemoryPool.Fee;
using Stratis.Bitcoin.Features.MemoryPool.Interfaces;
-using Stratis.Bitcoin.Features.MemoryPool.Rules;
using Stratis.Bitcoin.Interfaces;
using Stratis.Bitcoin.Utilities;
using TracerAttributes;
@@ -77,7 +76,6 @@ private void AddComponentStats(StringBuilder log)
{
if (this.mempoolManager != null)
{
- log.AppendLine();
log.AppendLine("=======Mempool=======");
log.AppendLine(this.mempoolManager.PerformanceCounter.ToString());
}
diff --git a/src/Stratis.Bitcoin.Features.MemoryPool/Rules/StraxCoinViewMempoolRule.cs b/src/Stratis.Bitcoin.Features.MemoryPool/Rules/StraxCoinViewMempoolRule.cs
index 06b679c7b9..e1cc5e170e 100644
--- a/src/Stratis.Bitcoin.Features.MemoryPool/Rules/StraxCoinViewMempoolRule.cs
+++ b/src/Stratis.Bitcoin.Features.MemoryPool/Rules/StraxCoinViewMempoolRule.cs
@@ -38,7 +38,7 @@ public override void CheckTransaction(MempoolValidationContext context)
if (unspentOutput.Coins.TxOut.ScriptPubKey == StraxCoinstakeRule.CirrusRewardScript)
{
- this.logger.LogDebug($"Reward distribution transaction seen in mempool, paying to '{unspentOutput.Coins.TxOut.ScriptPubKey}'.");
+ this.logger.LogDebug("Reward distribution transaction seen in mempool, paying to '{0}'.", unspentOutput.Coins.TxOut.ScriptPubKey);
foreach (TxOut output in context.Transaction.Outputs)
{
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 30a22e8cd7..0d6250c615 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.6.0
+ 1.0.6.1
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 c354b61878..c9ec28e30b 100644
--- a/src/Stratis.Bitcoin.Features.Miner/Stratis.Bitcoin.Features.Miner.csproj
+++ b/src/Stratis.Bitcoin.Features.Miner/Stratis.Bitcoin.Features.Miner.csproj
@@ -14,7 +14,7 @@
false
false
false
- 1.0.6.0
+ 1.0.6.1
False
Stratis Group Ltd.
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 770b068d9d..004a786b72 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.6.0
+ 1.0.6.1
False
Stratis Group Ltd.
diff --git a/src/Stratis.Bitcoin.Features.PoA/BasePoAFeatureConsensusRules/PoAHeaderSignatureRule.cs b/src/Stratis.Bitcoin.Features.PoA/BasePoAFeatureConsensusRules/PoAHeaderSignatureRule.cs
index 6e485bb1e4..cfb593bb85 100644
--- a/src/Stratis.Bitcoin.Features.PoA/BasePoAFeatureConsensusRules/PoAHeaderSignatureRule.cs
+++ b/src/Stratis.Bitcoin.Features.PoA/BasePoAFeatureConsensusRules/PoAHeaderSignatureRule.cs
@@ -94,7 +94,7 @@ public override async Task RunAsync(RuleContext context)
if (this.slotsManager.GetRoundLengthSeconds(this.federationHistory.GetFederationForBlock(prevHeader.Previous).Count) != roundTime)
break;
- this.Logger.LogDebug($"Block {prevHeader.HashBlock} was mined by the same miner '{pubKey.ToHex()}' as {blockCounter} blocks ({header.Time - prevHeader.Header.Time})s ago and there was no federation change.");
+ this.Logger.LogDebug("Block {0} was mined by the same miner '{1}' as {2} blocks ({3})s ago and there was no federation change.", prevHeader.HashBlock, pubKey.ToHex(), blockCounter, header.Time - prevHeader.Header.Time);
this.Logger.LogTrace("(-)[TIME_TOO_EARLY]");
ConsensusErrors.BlockTimestampTooEarly.Throw();
}
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 704fd0d596..3c3aa9a409 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.6.0
+ 1.0.6.1
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 0a2851197c..4aa0ddf9b3 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.6.0
+ 1.0.6.1
False
Stratis Group Ltd.
diff --git a/src/Stratis.Bitcoin.Features.SignalR/Broadcasters/BroadcasterBase.cs b/src/Stratis.Bitcoin.Features.SignalR/Broadcasters/BroadcasterBase.cs
index 21fa98f4fb..ac93c4ab87 100644
--- a/src/Stratis.Bitcoin.Features.SignalR/Broadcasters/BroadcasterBase.cs
+++ b/src/Stratis.Bitcoin.Features.SignalR/Broadcasters/BroadcasterBase.cs
@@ -33,7 +33,8 @@ protected ClientBroadcasterBase(
public void Init(ClientEventBroadcasterSettings broadcasterSettings)
{
- this.logger.LogDebug($"Initialising SignalR Broadcaster {this.GetType().Name}");
+ this.logger.LogDebug("Initialising SignalR Broadcaster {0}", this.GetType().Name);
+
this.asyncLoop = this.asyncProvider.CreateAndRunAsyncLoop(
$"Broadcast {this.GetType().Name}",
async token =>
diff --git a/src/Stratis.Bitcoin.Features.SignalR/Stratis.Bitcoin.Features.SignalR.csproj b/src/Stratis.Bitcoin.Features.SignalR/Stratis.Bitcoin.Features.SignalR.csproj
index 2d341c1523..f8e5f4d6dd 100644
--- a/src/Stratis.Bitcoin.Features.SignalR/Stratis.Bitcoin.Features.SignalR.csproj
+++ b/src/Stratis.Bitcoin.Features.SignalR/Stratis.Bitcoin.Features.SignalR.csproj
@@ -1,7 +1,7 @@
netcoreapp3.1
- 1.0.6.0
+ 1.0.6.1
Stratis.Features.SignalR
Stratis.Features.SignalR
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 f4c5006edd..2ebafc00e8 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.6.0
+ 1.0.6.1
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 c43ce60ea9..04f1c5ef85 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.6.0
+ 1.0.6.1
False
Stratis Group Ltd.
diff --git a/src/Stratis.Bitcoin.Features.WatchOnlyWallet/Stratis.Bitcoin.Features.WatchOnlyWallet.csproj b/src/Stratis.Bitcoin.Features.WatchOnlyWallet/Stratis.Bitcoin.Features.WatchOnlyWallet.csproj
index 48b1f708fb..2efbfa5dbf 100644
--- a/src/Stratis.Bitcoin.Features.WatchOnlyWallet/Stratis.Bitcoin.Features.WatchOnlyWallet.csproj
+++ b/src/Stratis.Bitcoin.Features.WatchOnlyWallet/Stratis.Bitcoin.Features.WatchOnlyWallet.csproj
@@ -14,7 +14,7 @@
false
false
false
- 1.0.6.0
+ 1.0.6.1
False
Stratis Group Ltd.
diff --git a/src/Stratis.Bitcoin.Networks/Stratis.Bitcoin.Networks.csproj b/src/Stratis.Bitcoin.Networks/Stratis.Bitcoin.Networks.csproj
index 6065a6d48d..36ccaabd72 100644
--- a/src/Stratis.Bitcoin.Networks/Stratis.Bitcoin.Networks.csproj
+++ b/src/Stratis.Bitcoin.Networks/Stratis.Bitcoin.Networks.csproj
@@ -14,9 +14,9 @@
false
false
false
- 1.0.6.0
- 1.0.6.0
- 1.0.6.0
+ 1.0.6.1
+ 1.0.6.1
+ 1.0.6.1
False
Stratis Group Ltd.
diff --git a/src/Stratis.Bitcoin/Properties/AssemblyInfo.cs b/src/Stratis.Bitcoin/Properties/AssemblyInfo.cs
index 46278e62d0..a6fea09e6c 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.6.0")]
-[assembly: AssemblyFileVersion("1.0.6.0")]
+[assembly: AssemblyVersion("1.0.6.1")]
+[assembly: AssemblyFileVersion("1.0.6.1")]
[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 c49d11a34e..f2056108d0 100644
--- a/src/Stratis.Bitcoin/Stratis.Bitcoin.csproj
+++ b/src/Stratis.Bitcoin/Stratis.Bitcoin.csproj
@@ -14,7 +14,7 @@
false
false
false
- 1.0.6.0
+ 1.0.6.1
False
..\Stratis.ruleset
Stratis Group Ltd.
diff --git a/src/Stratis.CirrusD/Stratis.CirrusD.csproj b/src/Stratis.CirrusD/Stratis.CirrusD.csproj
index 4c7504dea4..e8b5b69246 100644
--- a/src/Stratis.CirrusD/Stratis.CirrusD.csproj
+++ b/src/Stratis.CirrusD/Stratis.CirrusD.csproj
@@ -3,7 +3,7 @@
Exe
netcoreapp3.1
- 1.0.6.0
+ 1.0.6.1
Stratis Group Ltd.
Stratis Group Ltd.
diff --git a/src/Stratis.CirrusDnsD/Stratis.CirrusDnsD.csproj b/src/Stratis.CirrusDnsD/Stratis.CirrusDnsD.csproj
index 81e949c763..c8d6290ea3 100644
--- a/src/Stratis.CirrusDnsD/Stratis.CirrusDnsD.csproj
+++ b/src/Stratis.CirrusDnsD/Stratis.CirrusDnsD.csproj
@@ -17,7 +17,7 @@
latest
Stratis Group Ltd.
- 1.0.6.0
+ 1.0.6.1
diff --git a/src/Stratis.CirrusMinerD/Stratis.CirrusMinerD.csproj b/src/Stratis.CirrusMinerD/Stratis.CirrusMinerD.csproj
index 5dc4acc8fe..ac6e189731 100644
--- a/src/Stratis.CirrusMinerD/Stratis.CirrusMinerD.csproj
+++ b/src/Stratis.CirrusMinerD/Stratis.CirrusMinerD.csproj
@@ -3,7 +3,7 @@
Exe
netcoreapp3.1
- 1.0.6.0
+ 1.0.6.1
Stratis Group Ltd.
Stratis Group Ltd.
diff --git a/src/Stratis.CirrusPegD/Stratis.CirrusPegD.csproj b/src/Stratis.CirrusPegD/Stratis.CirrusPegD.csproj
index 8b222cf5a3..89556e30ca 100644
--- a/src/Stratis.CirrusPegD/Stratis.CirrusPegD.csproj
+++ b/src/Stratis.CirrusPegD/Stratis.CirrusPegD.csproj
@@ -3,7 +3,7 @@
Exe
netcoreapp3.1
- 1.0.6.0
+ 1.0.6.1
Stratis Group Ltd.
diff --git a/src/Stratis.Features.Diagnostic/Stratis.Features.Diagnostic.csproj b/src/Stratis.Features.Diagnostic/Stratis.Features.Diagnostic.csproj
index 5582b3b858..b824284736 100644
--- a/src/Stratis.Features.Diagnostic/Stratis.Features.Diagnostic.csproj
+++ b/src/Stratis.Features.Diagnostic/Stratis.Features.Diagnostic.csproj
@@ -4,7 +4,7 @@
netcoreapp3.1
..\None.ruleset
true
- 1.0.6.0
+ 1.0.6.1
Stratis Group Ltd.
diff --git a/src/Stratis.Features.FederatedPeg.Tests/ControllersTests/FederationWalletControllerTests.cs b/src/Stratis.Features.FederatedPeg.Tests/ControllersTests/FederationWalletControllerTests.cs
index 7a24249a61..e118ad686b 100644
--- a/src/Stratis.Features.FederatedPeg.Tests/ControllersTests/FederationWalletControllerTests.cs
+++ b/src/Stratis.Features.FederatedPeg.Tests/ControllersTests/FederationWalletControllerTests.cs
@@ -54,7 +54,7 @@ public FederationWalletControllerTests()
this.withdrawalHistoryProvider = Substitute.For();
this.controller = new FederationWalletController(this.loggerFactory, this.walletManager, this.walletSyncManager,
- this.connectionManager, this.network, this.chainIndexer, this.dateTimeProvider, this.withdrawalHistoryProvider);
+ this.connectionManager, this.network, this.chainIndexer, Substitute.For());
this.fedWallet = new FederationWallet
{
@@ -106,7 +106,7 @@ public void GetHistory()
{
var withdrawals = new List() { new WithdrawalModel(), new WithdrawalModel() };
- this.withdrawalHistoryProvider.GetHistory(0).ReturnsForAnyArgs(withdrawals);
+ this.withdrawalHistoryProvider.GetHistory(new[] { new CrossChainTransfer() }, 0).ReturnsForAnyArgs(withdrawals);
IActionResult result = this.controller.GetHistory(5);
List model = this.ActionResultToModel>(result);
@@ -141,8 +141,10 @@ public void EnableFederation()
[Fact]
public void RemoveTransactions()
{
- var hashSet = new HashSet<(uint256, DateTimeOffset)>();
- hashSet.Add((uint256.One, DateTimeOffset.MinValue));
+ var hashSet = new HashSet<(uint256, DateTimeOffset)>
+ {
+ (uint256.One, DateTimeOffset.MinValue)
+ };
this.walletManager.RemoveAllTransactions().Returns(info => hashSet);
diff --git a/src/Stratis.Features.FederatedPeg.Tests/CrossChainTestBase.cs b/src/Stratis.Features.FederatedPeg.Tests/CrossChainTestBase.cs
index 4380bc9eed..7c6d6584b5 100644
--- a/src/Stratis.Features.FederatedPeg.Tests/CrossChainTestBase.cs
+++ b/src/Stratis.Features.FederatedPeg.Tests/CrossChainTestBase.cs
@@ -206,6 +206,7 @@ protected void Init(DataFolder dataFolder)
this.federationWalletManager = new FederationWalletManager(
this.loggerFactory,
this.network,
+ Substitute.For(),
this.ChainIndexer,
dataFolder,
this.walletFeePolicy,
@@ -244,8 +245,8 @@ protected void Init(DataFolder dataFolder)
protected ICrossChainTransferStore CreateStore()
{
- return new CrossChainTransferStore(this.network, this.dataFolder, this.ChainIndexer, this.federatedPegSettings, this.dateTimeProvider,
- this.loggerFactory, this.withdrawalExtractor, this.blockRepository, this.federationWalletManager, this.withdrawalTransactionBuilder, this.dBreezeSerializer, this.signals, this.stateRepositoryRoot);
+ return new CrossChainTransferStore(this.network, Substitute.For(), this.dataFolder, this.ChainIndexer, this.federatedPegSettings, this.dateTimeProvider,
+ this.loggerFactory, this.withdrawalExtractor, Substitute.For(), this.blockRepository, this.federationWalletManager, this.withdrawalTransactionBuilder, this.dBreezeSerializer, this.signals, this.stateRepositoryRoot);
}
///
diff --git a/src/Stratis.Features.FederatedPeg.Tests/Wallet/FederationWalletManagerTests.cs b/src/Stratis.Features.FederatedPeg.Tests/Wallet/FederationWalletManagerTests.cs
index e729062bb8..8bd50296e4 100644
--- a/src/Stratis.Features.FederatedPeg.Tests/Wallet/FederationWalletManagerTests.cs
+++ b/src/Stratis.Features.FederatedPeg.Tests/Wallet/FederationWalletManagerTests.cs
@@ -113,6 +113,7 @@ private FederationWalletManager CreateFederationWalletManager()
var federationWalletManager = new FederationWalletManager(
loggerFactory.Object,
this.network,
+ new Mock().Object,
chainIndexer,
dataFolder,
new Mock().Object,
diff --git a/src/Stratis.Features.FederatedPeg/Controllers/FederationWalletController.cs b/src/Stratis.Features.FederatedPeg/Controllers/FederationWalletController.cs
index 4c643a63d7..09f5e674db 100644
--- a/src/Stratis.Features.FederatedPeg/Controllers/FederationWalletController.cs
+++ b/src/Stratis.Features.FederatedPeg/Controllers/FederationWalletController.cs
@@ -15,7 +15,6 @@
using Stratis.Bitcoin.Utilities.ModelStateErrors;
using Stratis.Features.FederatedPeg.Interfaces;
using Stratis.Features.FederatedPeg.Models;
-using Stratis.Features.FederatedPeg.TargetChain;
using Stratis.Features.FederatedPeg.Wallet;
namespace Stratis.Features.FederatedPeg.Controllers
@@ -37,18 +36,13 @@ public static class FederationWalletRouteEndPoint
[Route("api/[controller]")]
public class FederationWalletController : Controller
{
+ private readonly ICrossChainTransferStore crossChainTransferStore;
private readonly IFederationWalletManager federationWalletManager;
-
+ private readonly Network network;
private readonly IFederationWalletSyncManager walletSyncManager;
-
- private readonly CoinType coinType;
-
private readonly IConnectionManager connectionManager;
-
private readonly ChainIndexer chainIndexer;
- private readonly IWithdrawalHistoryProvider withdrawalHistoryProvider;
-
/// Instance logger.
private readonly ILogger logger;
@@ -59,16 +53,15 @@ public FederationWalletController(
IConnectionManager connectionManager,
Network network,
ChainIndexer chainIndexer,
- IDateTimeProvider dateTimeProvider,
- IWithdrawalHistoryProvider withdrawalHistoryProvider)
+ ICrossChainTransferStore crossChainTransferStore)
{
- this.federationWalletManager = walletManager;
- this.walletSyncManager = walletSyncManager;
this.connectionManager = connectionManager;
- this.withdrawalHistoryProvider = withdrawalHistoryProvider;
- this.coinType = (CoinType)network.Consensus.CoinType;
+ this.crossChainTransferStore = crossChainTransferStore;
this.chainIndexer = chainIndexer;
+ this.federationWalletManager = walletManager;
+ this.network = network;
this.logger = loggerFactory.CreateLogger(this.GetType().FullName);
+ this.walletSyncManager = walletSyncManager;
}
///
@@ -136,13 +129,13 @@ public IActionResult GetBalance()
return this.NotFound("No federation wallet found.");
}
- (Money ConfirmedAmount, Money UnConfirmedAmount) result = this.federationWalletManager.GetSpendableAmount();
+ (Money ConfirmedAmount, Money UnConfirmedAmount) = this.federationWalletManager.GetSpendableAmount();
var balance = new AccountBalanceModel
{
- CoinType = this.coinType,
- AmountConfirmed = result.ConfirmedAmount,
- AmountUnconfirmed = result.UnConfirmedAmount,
+ CoinType = (CoinType)this.network.Consensus.CoinType,
+ AmountConfirmed = ConfirmedAmount,
+ AmountUnconfirmed = UnConfirmedAmount,
};
var model = new WalletBalanceModel();
@@ -175,11 +168,9 @@ public IActionResult GetHistory([FromQuery] int maxEntriesToReturn)
{
FederationWallet wallet = this.federationWalletManager.GetWallet();
if (wallet == null)
- {
return this.NotFound("No federation wallet found.");
- }
- List result = this.withdrawalHistoryProvider.GetHistory(maxEntriesToReturn);
+ List result = this.crossChainTransferStore.GetCompletedWithdrawals(maxEntriesToReturn);
return this.Json(result);
}
@@ -235,7 +226,7 @@ public IActionResult Sync([FromBody] HashModel model)
[ProducesResponseType((int)HttpStatusCode.BadRequest)]
[ProducesResponseType((int)HttpStatusCode.NotFound)]
[ProducesResponseType((int)HttpStatusCode.InternalServerError)]
- public IActionResult EnableFederation([FromBody]EnableFederationRequest request)
+ public IActionResult EnableFederation([FromBody] EnableFederationRequest request)
{
Guard.NotNull(request, nameof(request));
@@ -282,7 +273,7 @@ public IActionResult EnableFederation([FromBody]EnableFederationRequest request)
[ProducesResponseType((int)HttpStatusCode.OK)]
[ProducesResponseType((int)HttpStatusCode.BadRequest)]
[ProducesResponseType((int)HttpStatusCode.InternalServerError)]
- public IActionResult RemoveTransactions([FromQuery]RemoveFederationTransactionsModel request)
+ public IActionResult RemoveTransactions([FromQuery] RemoveFederationTransactionsModel request)
{
Guard.NotNull(request, nameof(request));
diff --git a/src/Stratis.Features.FederatedPeg/Distribution/RewardDistributionManager.cs b/src/Stratis.Features.FederatedPeg/Distribution/RewardDistributionManager.cs
index 1ee1993401..ff4683e607 100644
--- a/src/Stratis.Features.FederatedPeg/Distribution/RewardDistributionManager.cs
+++ b/src/Stratis.Features.FederatedPeg/Distribution/RewardDistributionManager.cs
@@ -121,7 +121,7 @@ public List Distribute(int heightOfRecordedDistributionDeposit, Money
// Ensure that the dictionary is cleared on every run.
// As this is a static class, new instances of this dictionary will
- // only be cleaned up once the node shutsdown. It is therefore better
+ // only be cleaned up once the node shuts down. It is therefore better
// to use a single instance to work with.
this.blocksMinedEach.Clear();
diff --git a/src/Stratis.Features.FederatedPeg/FederatedPegFeature.cs b/src/Stratis.Features.FederatedPeg/FederatedPegFeature.cs
index 3469f522a3..91f48a4ab4 100644
--- a/src/Stratis.Features.FederatedPeg/FederatedPegFeature.cs
+++ b/src/Stratis.Features.FederatedPeg/FederatedPegFeature.cs
@@ -13,7 +13,6 @@
using Stratis.Bitcoin.Configuration;
using Stratis.Bitcoin.Configuration.Logging;
using Stratis.Bitcoin.Connection;
-using Stratis.Bitcoin.Features.Api;
using Stratis.Bitcoin.Features.Miner;
using Stratis.Bitcoin.Features.Notifications;
using Stratis.Bitcoin.Features.SmartContracts;
@@ -26,7 +25,6 @@
using Stratis.Features.FederatedPeg.Distribution;
using Stratis.Features.FederatedPeg.InputConsolidation;
using Stratis.Features.FederatedPeg.Interfaces;
-using Stratis.Features.FederatedPeg.Models;
using Stratis.Features.FederatedPeg.Notifications;
using Stratis.Features.FederatedPeg.Payloads;
using Stratis.Features.FederatedPeg.SourceChain;
@@ -41,16 +39,6 @@ namespace Stratis.Features.FederatedPeg
{
internal class FederatedPegFeature : FullNodeFeature
{
- ///
- /// Given that we can have up to 10 UTXOs going at once.
- ///
- private const int TransfersToDisplay = 10;
-
- ///
- /// The maximum number of pending transactions to display in the console logging.
- ///
- private const int PendingToDisplay = 25;
-
public const string FederationGatewayFeatureNamespace = "federationgateway";
private readonly IConnectionManager connectionManager;
@@ -65,8 +53,6 @@ internal class FederatedPegFeature : FullNodeFeature
private readonly IFederationWalletSyncManager walletSyncManager;
- private readonly ChainIndexer chainIndexer;
-
private readonly Network network;
private readonly ICrossChainTransferStore crossChainTransferStore;
@@ -79,8 +65,6 @@ internal class FederatedPegFeature : FullNodeFeature
private readonly IMaturedBlocksSyncManager maturedBlocksSyncManager;
- private readonly IWithdrawalHistoryProvider withdrawalHistoryProvider;
-
private readonly IInputConsolidator inputConsolidator;
private readonly ILogger logger;
@@ -93,14 +77,12 @@ public FederatedPegFeature(
IFederationWalletManager federationWalletManager,
IFederationWalletSyncManager walletSyncManager,
Network network,
- ChainIndexer chainIndexer,
INodeStats nodeStats,
ICrossChainTransferStore crossChainTransferStore,
IPartialTransactionRequester partialTransactionRequester,
MempoolCleaner mempoolCleaner,
ISignedMultisigTransactionBroadcaster signedBroadcaster,
IMaturedBlocksSyncManager maturedBlocksSyncManager,
- IWithdrawalHistoryProvider withdrawalHistoryProvider,
IInputConsolidator inputConsolidator,
ICollateralChecker collateralChecker = null)
{
@@ -108,7 +90,6 @@ public FederatedPegFeature(
this.connectionManager = connectionManager;
this.federatedPegSettings = federatedPegSettings;
this.fullNode = fullNode;
- this.chainIndexer = chainIndexer;
this.federationWalletManager = federationWalletManager;
this.walletSyncManager = walletSyncManager;
this.network = network;
@@ -116,7 +97,6 @@ public FederatedPegFeature(
this.partialTransactionRequester = partialTransactionRequester;
this.mempoolCleaner = mempoolCleaner;
this.maturedBlocksSyncManager = maturedBlocksSyncManager;
- this.withdrawalHistoryProvider = withdrawalHistoryProvider;
this.signedBroadcaster = signedBroadcaster;
this.inputConsolidator = inputConsolidator;
@@ -127,7 +107,6 @@ public FederatedPegFeature(
payloadProvider.AddPayload(typeof(RequestPartialTransactionPayload));
nodeStats.RegisterStats(this.AddComponentStats, StatsType.Component, this.GetType().Name);
- nodeStats.RegisterStats(this.AddInlineStats, StatsType.Inline, this.GetType().Name, 800);
}
public override async Task InitializeAsync()
@@ -196,22 +175,6 @@ public override void Dispose()
this.crossChainTransferStore.Dispose();
}
- [NoTrace]
- private void AddInlineStats(StringBuilder benchLogs)
- {
- if (this.federationWalletManager == null)
- return;
-
- int height = this.federationWalletManager.LastBlockSyncedHashHeight().Height;
- ChainedHeader block = this.chainIndexer.GetHeader(height);
- uint256 hashBlock = block == null ? 0 : block.HashBlock;
-
- FederationWallet federationWallet = this.federationWalletManager.GetWallet();
- benchLogs.AppendLine("Fed.Wallet.Height: ".PadRight(LoggingConfiguration.ColumnLength + 1) +
- (federationWallet != null ? height.ToString().PadRight(8) : "No Wallet".PadRight(8)) +
- (federationWallet != null ? (" Fed.Wallet.Hash: ".PadRight(LoggingConfiguration.ColumnLength - 1) + hashBlock) : string.Empty));
- }
-
[NoTrace]
private void AddComponentStats(StringBuilder benchLog)
{
@@ -230,38 +193,14 @@ private void AddComponentStats(StringBuilder benchLog)
private string CollectStats()
{
StringBuilder benchLog = new StringBuilder();
- benchLog.AppendLine();
- benchLog.AppendLine("====== Federation Wallet ======");
-
- (Money ConfirmedAmount, Money UnConfirmedAmount) = this.federationWalletManager.GetSpendableAmount();
-
- bool isFederationActive = this.federationWalletManager.IsFederationWalletActive();
-
- benchLog.AppendLine("Federation Wallet: ".PadRight(LoggingConfiguration.ColumnLength)
- + " Confirmed balance: " + ConfirmedAmount.ToString().PadRight(LoggingConfiguration.ColumnLength)
- + " Reserved for withdrawals: " + UnConfirmedAmount.ToString().PadRight(LoggingConfiguration.ColumnLength)
- + " Federation Status: " + (isFederationActive ? "Active" : "Inactive"));
- benchLog.AppendLine();
-
- if (!isFederationActive)
- {
- var apiSettings = (ApiSettings)this.fullNode.Services.ServiceProvider.GetService(typeof(ApiSettings));
-
- benchLog.AppendLine("".PadRight(59, '=') + " W A R N I N G " + "".PadRight(59, '='));
- benchLog.AppendLine();
- benchLog.AppendLine("This federation node is not enabled. You will not be able to store or participate in signing of transactions until you enable it.");
- benchLog.AppendLine("If not done previously, please enable your federation node using " + $"{apiSettings.ApiUri}/api/FederationWallet/{FederationWalletRouteEndPoint.EnableFederation}.");
- benchLog.AppendLine();
- benchLog.AppendLine("".PadRight(133, '='));
- benchLog.AppendLine();
- }
List consolidationPartials = this.inputConsolidator.ConsolidationTransactions;
if (consolidationPartials != null)
{
benchLog.AppendLine("--- Consolidation Transactions in Memory ---");
- foreach (ConsolidationTransaction partial in consolidationPartials)
+
+ foreach (ConsolidationTransaction partial in consolidationPartials.Take(20))
{
benchLog.AppendLine(
string.Format("Tran#={0} TotalOut={1,12} Status={2} Signatures=({3}/{4})",
@@ -273,6 +212,10 @@ private string CollectStats()
)
);
}
+
+ if (consolidationPartials.Count > 20)
+ benchLog.AppendLine($"and {consolidationPartials.Count - 20} more...");
+
benchLog.AppendLine();
}
@@ -296,81 +239,8 @@ private string CollectStats()
benchLog.AppendLine();
}
- try
- {
- List pendingWithdrawals = this.withdrawalHistoryProvider.GetPending();
-
- if (pendingWithdrawals.Count > 0)
- {
- benchLog.AppendLine("--- Pending Withdrawals ---");
- foreach (WithdrawalModel withdrawal in pendingWithdrawals.Take(PendingToDisplay))
- benchLog.AppendLine(withdrawal.ToString());
-
- if (pendingWithdrawals.Count > PendingToDisplay)
- benchLog.AppendLine($"And {pendingWithdrawals.Count - PendingToDisplay} more...");
-
- benchLog.AppendLine();
- }
- }
- catch (Exception exception)
- {
- benchLog.AppendLine("--- Pending Withdrawals ---");
- benchLog.AppendLine("Failed to retrieve data");
- this.logger.LogError("Exception occurred while getting pending withdrawals: '{0}'.", exception.ToString());
- }
-
- List completedWithdrawals = this.withdrawalHistoryProvider.GetHistory(TransfersToDisplay);
-
- if (completedWithdrawals.Count > 0)
- {
- benchLog.AppendLine("--- Recently Completed Withdrawals ---");
- foreach (WithdrawalModel withdrawal in completedWithdrawals)
- benchLog.AppendLine(withdrawal.ToString());
- benchLog.AppendLine();
- }
-
- benchLog.AppendLine("====== Cross Chain Transfer Store ======");
- this.AddBenchmarkLine(benchLog, new (string, int)[] {
- ("Height:", LoggingConfiguration.ColumnLength),
- (this.crossChainTransferStore.TipHashAndHeight.Height.ToString(), LoggingConfiguration.ColumnLength),
- ("Hash:",LoggingConfiguration.ColumnLength),
- (this.crossChainTransferStore.TipHashAndHeight.HashBlock.ToString(), 0),
- ("NextDepositHeight:", LoggingConfiguration.ColumnLength),
- (this.crossChainTransferStore.NextMatureDepositHeight.ToString(), LoggingConfiguration.ColumnLength),
- ("HasSuspended:",LoggingConfiguration.ColumnLength),
- (this.crossChainTransferStore.HasSuspended().ToString(), 0)
- },
- 4);
-
- this.AddBenchmarkLine(benchLog,
- this.crossChainTransferStore.GetCrossChainTransferStatusCounter().SelectMany(item => new (string, int)[]{
- (item.Key.ToString()+":", LoggingConfiguration.ColumnLength),
- (item.Value.ToString(), LoggingConfiguration.ColumnLength)
- }).ToArray(),
- 4);
-
return benchLog.ToString();
}
-
- [NoTrace]
- private void AddBenchmarkLine(StringBuilder benchLog, (string Value, int ValuePadding)[] items, int maxItemsPerLine = int.MaxValue)
- {
- if (items == null)
- return;
-
- int itemsAdded = 0;
- foreach ((string Value, int ValuePadding) in items)
- {
- if (itemsAdded++ >= maxItemsPerLine)
- {
- benchLog.AppendLine();
- itemsAdded = 1;
- }
- benchLog.Append(Value.PadRight(ValuePadding));
- }
-
- benchLog.AppendLine();
- }
}
///
diff --git a/src/Stratis.Features.FederatedPeg/Interfaces/ICrossChainTransferStore.cs b/src/Stratis.Features.FederatedPeg/Interfaces/ICrossChainTransferStore.cs
index 6c1a4fb751..34db6b3cfd 100644
--- a/src/Stratis.Features.FederatedPeg/Interfaces/ICrossChainTransferStore.cs
+++ b/src/Stratis.Features.FederatedPeg/Interfaces/ICrossChainTransferStore.cs
@@ -91,17 +91,18 @@ public interface ICrossChainTransferStore : IDisposable
/// The block height on the counter-chain for which the next list of deposits is expected.
int NextMatureDepositHeight { get; }
- ///
- /// Gets the counter of the cross chain transfer for each available status
- ///
- /// The counter of the cross chain transfer for each status
- Dictionary GetCrossChainTransferStatusCounter();
-
///
/// Determines, for a list of input transactions, which of those are completed or unknown withdrawals.
///
/// The list of input transactions.
/// The list of transactions that are completed (or unknown) wihdrawals.
- List CompletedWithdrawals(IEnumerable transactionsToCheck);
+ List GetCompletedWithdrawalsForTransactions(IEnumerable transactionsToCheck);
+
+ ///
+ /// Returns a list of completed withdrawals (those that are seen-in-block).
+ ///
+ /// The max items to display.
+ /// The completed withdrawals.
+ List GetCompletedWithdrawals(int transfersToDisplay);
}
}
diff --git a/src/Stratis.Features.FederatedPeg/Models/WithdrawalModel.cs b/src/Stratis.Features.FederatedPeg/Models/WithdrawalModel.cs
index 02e0501d07..cef104f5a3 100644
--- a/src/Stratis.Features.FederatedPeg/Models/WithdrawalModel.cs
+++ b/src/Stratis.Features.FederatedPeg/Models/WithdrawalModel.cs
@@ -50,7 +50,7 @@ public override string ToString()
{
var stringBuilder = new StringBuilder();
- stringBuilder.Append(string.Format("Block Height={0,8} Paying={1} Amount={2,12} Status={3}",
+ stringBuilder.Append(string.Format("Block Height={0,8} Paying={1} Amount={2,14} Status={3}",
this.BlockHeight == 0 ? "Unconfirmed" : this.BlockHeight.ToString(),
this.PayingTo,
this.Amount.ToString(),
diff --git a/src/Stratis.Features.FederatedPeg/PartialTransactionsBehavior.cs b/src/Stratis.Features.FederatedPeg/PartialTransactionsBehavior.cs
index 4b4e66ad6d..c991e35c7a 100644
--- a/src/Stratis.Features.FederatedPeg/PartialTransactionsBehavior.cs
+++ b/src/Stratis.Features.FederatedPeg/PartialTransactionsBehavior.cs
@@ -60,13 +60,13 @@ public override object Clone()
protected override void AttachCore()
{
- this.logger.LogDebug($"Attaching behaviour for {this.AttachedPeer.PeerEndPoint.Address}");
+ this.logger.LogDebug("Attaching behaviour for {0}", this.AttachedPeer.PeerEndPoint.Address);
this.AttachedPeer.MessageReceived.Register(this.OnMessageReceivedAsync, true);
}
protected override void DetachCore()
{
- this.logger.LogDebug($"Detaching behaviour for {this.AttachedPeer.PeerEndPoint.Address}");
+ this.logger.LogDebug("Detaching behaviour for {0}", this.AttachedPeer.PeerEndPoint.Address);
this.AttachedPeer.MessageReceived.Unregister(this.OnMessageReceivedAsync);
}
@@ -76,7 +76,7 @@ protected override void DetachCore()
/// The payload to broadcast.
private async Task BroadcastAsync(RequestPartialTransactionPayload payload)
{
- this.logger.LogDebug($"Broadcasting to {this.AttachedPeer.PeerEndPoint.Address}");
+ this.logger.LogDebug("Broadcasting to {0}", this.AttachedPeer.PeerEndPoint.Address);
await this.AttachedPeer.SendMessageAsync(payload).ConfigureAwait(false);
}
@@ -93,7 +93,7 @@ private async Task OnMessageReceivedAsync(INetworkPeer peer, IncomingMessage mes
return;
}
- this.logger.LogDebug($"{nameof(RequestPartialTransactionPayload)} received from '{peer.PeerEndPoint.Address}':'{peer.RemoteSocketEndpoint.Address}'.");
+ this.logger.LogDebug("{0} received from '{1}':'{2}'.", nameof(RequestPartialTransactionPayload), peer.PeerEndPoint.Address, peer.RemoteSocketEndpoint.Address);
ICrossChainTransfer[] transfer = await this.crossChainTransferStore.GetAsync(new[] { payload.DepositId });
@@ -143,7 +143,7 @@ private async Task OnMessageReceivedAsync(INetworkPeer peer, IncomingMessage mes
}
else
{
- this.logger.LogDebug($"The old and signed hash matches '{oldHash}'.");
+ this.logger.LogDebug("The old and signed hash matches '{0}'.", oldHash);
}
}
diff --git a/src/Stratis.Features.FederatedPeg/SourceChain/MaturedBlocksProvider.cs b/src/Stratis.Features.FederatedPeg/SourceChain/MaturedBlocksProvider.cs
index 11522097f4..ce16b84277 100644
--- a/src/Stratis.Features.FederatedPeg/SourceChain/MaturedBlocksProvider.cs
+++ b/src/Stratis.Features.FederatedPeg/SourceChain/MaturedBlocksProvider.cs
@@ -108,7 +108,7 @@ public SerializableResult> RetrieveDeposits(int
// Don't process blocks below the requested maturity height.
if (chainedHeaderBlock.ChainedHeader.Height < maturityHeight)
{
- this.logger.LogDebug($"{chainedHeaderBlock.ChainedHeader} below maturity height of {maturityHeight}.");
+ this.logger.LogDebug("{0} below maturity height of {1}.", chainedHeaderBlock.ChainedHeader, maturityHeight);
continue;
}
@@ -126,7 +126,7 @@ public SerializableResult> RetrieveDeposits(int
}
}
- this.logger.LogDebug($"{maturedDeposits.Count} mature deposits retrieved from block '{chainedHeaderBlock.ChainedHeader}'.");
+ this.logger.LogDebug("{0} mature deposits retrieved from block '{1}'.", maturedDeposits.Count, chainedHeaderBlock.ChainedHeader);
result.Value.Add(new MaturedBlockDepositsModel(new MaturedBlockInfoModel()
{
@@ -171,13 +171,13 @@ private void RecordBlockDeposits(ChainedHeaderBlock chainedHeaderBlock, DepositR
// Already have this recorded?
if (this.deposits.TryGetValue(chainedHeaderBlock.ChainedHeader.Height, out BlockDeposits blockDeposits) && blockDeposits.BlockHash == chainedHeaderBlock.ChainedHeader.HashBlock)
{
- this.logger.LogDebug($"Deposits already recorded for '{chainedHeaderBlock.ChainedHeader}'.");
+ this.logger.LogDebug("Deposits already recorded for '{0}'.", chainedHeaderBlock.ChainedHeader);
return;
}
IReadOnlyList deposits = this.depositExtractor.ExtractDepositsFromBlock(chainedHeaderBlock.Block, chainedHeaderBlock.ChainedHeader.Height, retrievalTypes);
- this.logger.LogDebug($"{deposits.Count} potential deposits extracted from block '{chainedHeaderBlock.ChainedHeader}'.");
+ this.logger.LogDebug("{0} potential deposits extracted from block '{1}'.", deposits.Count, chainedHeaderBlock.ChainedHeader);
this.deposits[chainedHeaderBlock.ChainedHeader.Height] = new BlockDeposits()
{
diff --git a/src/Stratis.Features.FederatedPeg/TargetChain/CrossChainTransferStore.cs b/src/Stratis.Features.FederatedPeg/TargetChain/CrossChainTransferStore.cs
index dff7255d9b..fc6a64c57a 100644
--- a/src/Stratis.Features.FederatedPeg/TargetChain/CrossChainTransferStore.cs
+++ b/src/Stratis.Features.FederatedPeg/TargetChain/CrossChainTransferStore.cs
@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
+using System.Text;
using System.Threading;
using System.Threading.Tasks;
using DBreeze;
@@ -25,6 +26,11 @@ namespace Stratis.Features.FederatedPeg.TargetChain
{
public class CrossChainTransferStore : ICrossChainTransferStore
{
+ ///
+ /// Given that we can have up to 10 UTXOs going at once.
+ ///
+ private const int TransfersToDisplay = 10;
+
///
/// Maximum number of partial transactions.
///
@@ -66,23 +72,25 @@ public class CrossChainTransferStore : ICrossChainTransferStore
/// Access to DBreeze database.
private readonly DBreezeEngine DBreeze;
- private readonly DBreezeSerializer dBreezeSerializer;
- private readonly Network network;
- private readonly ChainIndexer chainIndexer;
- private readonly IWithdrawalExtractor withdrawalExtractor;
private readonly IBlockRepository blockRepository;
private readonly CancellationTokenSource cancellation;
+ private readonly ChainIndexer chainIndexer;
+ private readonly DBreezeSerializer dBreezeSerializer;
private readonly IFederationWalletManager federationWalletManager;
- private readonly IWithdrawalTransactionBuilder withdrawalTransactionBuilder;
+ private readonly Network network;
+ private readonly INodeStats nodeStats;
private readonly IFederatedPegSettings settings;
private readonly ISignals signals;
private readonly IStateRepositoryRoot stateRepositoryRoot;
+ private readonly IWithdrawalExtractor withdrawalExtractor;
+ private readonly IWithdrawalHistoryProvider withdrawalHistoryProvider;
+ private readonly IWithdrawalTransactionBuilder withdrawalTransactionBuilder;
/// Provider of time functions.
private readonly object lockObj;
- public CrossChainTransferStore(Network network, DataFolder dataFolder, ChainIndexer chainIndexer, IFederatedPegSettings settings, IDateTimeProvider dateTimeProvider,
- ILoggerFactory loggerFactory, IWithdrawalExtractor withdrawalExtractor, IBlockRepository blockRepository, IFederationWalletManager federationWalletManager,
+ public CrossChainTransferStore(Network network, INodeStats nodeStats, DataFolder dataFolder, ChainIndexer chainIndexer, IFederatedPegSettings settings, IDateTimeProvider dateTimeProvider,
+ ILoggerFactory loggerFactory, IWithdrawalExtractor withdrawalExtractor, IWithdrawalHistoryProvider withdrawalHistoryProvider, IBlockRepository blockRepository, IFederationWalletManager federationWalletManager,
IWithdrawalTransactionBuilder withdrawalTransactionBuilder, DBreezeSerializer dBreezeSerializer, ISignals signals, IStateRepositoryRoot stateRepositoryRoot = null)
{
if (!settings.IsMainChain)
@@ -102,11 +110,10 @@ public CrossChainTransferStore(Network network, DataFolder dataFolder, ChainInde
Guard.NotNull(withdrawalTransactionBuilder, nameof(withdrawalTransactionBuilder));
this.network = network;
+ this.nodeStats = nodeStats;
this.chainIndexer = chainIndexer;
this.blockRepository = blockRepository;
this.federationWalletManager = federationWalletManager;
- this.withdrawalTransactionBuilder = withdrawalTransactionBuilder;
- this.withdrawalExtractor = withdrawalExtractor;
this.dBreezeSerializer = dBreezeSerializer;
this.lockObj = new object();
this.logger = loggerFactory.CreateLogger(this.GetType().FullName);
@@ -116,6 +123,9 @@ public CrossChainTransferStore(Network network, DataFolder dataFolder, ChainInde
this.settings = settings;
this.signals = signals;
this.stateRepositoryRoot = stateRepositoryRoot;
+ this.withdrawalExtractor = withdrawalExtractor;
+ this.withdrawalHistoryProvider = withdrawalHistoryProvider;
+ this.withdrawalTransactionBuilder = withdrawalTransactionBuilder;
// Future-proof store name.
string depositStoreName = "federatedTransfers" + settings.MultiSigAddress.ToString();
@@ -126,6 +136,8 @@ public CrossChainTransferStore(Network network, DataFolder dataFolder, ChainInde
// Initialize tracking deposits by status.
foreach (object status in typeof(CrossChainTransferStatus).GetEnumValues())
this.depositsIdsByStatus[(CrossChainTransferStatus)status] = new HashSet();
+
+ nodeStats.RegisterStats(this.AddComponentStats, StatsType.Component, this.GetType().Name);
}
/// Performs any needed initialisation for the database.
@@ -419,6 +431,7 @@ public Task RecordLatestMatureDepositsAsync(IL
return;
this.logger.LogInformation($"{maturedBlockDeposits.Count} blocks received, containing a total of {maturedBlockDeposits.SelectMany(d => d.Deposits).Where(a => a.Amount > 0).Count()} deposits.");
+ this.logger.LogInformation($"Block Range : {maturedBlockDeposits.Min(a => a.BlockInfo.BlockHeight)} to {maturedBlockDeposits.Max(a => a.BlockInfo.BlockHeight)}.");
foreach (MaturedBlockDepositsModel maturedDeposit in maturedBlockDeposits)
{
@@ -483,10 +496,10 @@ public Task RecordLatestMatureDepositsAsync(IL
{
status = CrossChainTransferStatus.Rejected;
}
- else if ((tracker.Count(t => t.Value == CrossChainTransferStatus.Partial)
- + this.depositsIdsByStatus.Count(t => t.Key == CrossChainTransferStatus.Partial)) >= MaximumPartialTransactions)
+ else if ((tracker.Count(t => t.Value == CrossChainTransferStatus.Partial) + this.depositsIdsByStatus[CrossChainTransferStatus.Partial].Count) >= MaximumPartialTransactions)
{
haveSuspendedTransfers = true;
+ this.logger.LogInformation($"Partial transaction limit reached, processing of deposits will continue once the partial transaction count falls below {MaximumPartialTransactions}.");
}
else
{
@@ -619,7 +632,7 @@ public Transaction MergeTransactionSignatures(uint256 depositId, Transaction[] p
if (transfer.Status != CrossChainTransferStatus.Partial)
{
- this.logger.LogDebug($"(-)[MERGE_BAD_STATUS]:{nameof(transfer.Status)}={transfer.Status}");
+ this.logger.LogDebug("(-)[MERGE_BAD_STATUS]:{0}={1}", nameof(transfer.Status), transfer.Status);
return transfer.PartialTransaction;
}
@@ -1223,6 +1236,11 @@ public ICrossChainTransfer[] GetTransfersByStatus(CrossChainTransferStatus[] sta
}
}
+ private int GetTransfersByStatusCount(CrossChainTransferStatus status)
+ {
+ return this.depositsIdsByStatus[status].Count;
+ }
+
/// Persist the cross-chain transfer information into the database.
/// The DBreeze transaction context to use.
/// Cross-chain transfer information to be inserted.
@@ -1374,22 +1392,7 @@ public bool ValidateTransaction(Transaction transaction, bool checkSignature = f
}
///
- public Dictionary GetCrossChainTransferStatusCounter()
- {
- lock (this.lockObj)
- {
- Dictionary result = new Dictionary();
- foreach (CrossChainTransferStatus status in Enum.GetValues(typeof(CrossChainTransferStatus)).Cast())
- {
- result[status] = this.depositsIdsByStatus.TryGet(status)?.Count ?? 0;
- }
-
- return result;
- }
- }
-
- ///
- public List CompletedWithdrawals(IEnumerable transactionsToCheck)
+ public List GetCompletedWithdrawalsForTransactions(IEnumerable transactionsToCheck)
{
var res = new List();
@@ -1436,6 +1439,74 @@ public static bool IsMempoolErrorRecoverable(MempoolError mempoolError)
}
}
+ private void AddComponentStats(StringBuilder benchLog)
+ {
+ benchLog.AppendLine("====== Cross Chain Transfer Store ======");
+ benchLog.AppendLine("Height:".PadRight(20) + this.TipHashAndHeight.Height + $" [{this.TipHashAndHeight.HashBlock}]");
+ benchLog.AppendLine("NextDepositHeight:".PadRight(20) + this.NextMatureDepositHeight);
+ benchLog.AppendLine("Partial Txs:".PadRight(20) + GetTransfersByStatusCount(CrossChainTransferStatus.Partial));
+ benchLog.AppendLine("Suspended Txs:".PadRight(20) + GetTransfersByStatusCount(CrossChainTransferStatus.Suspended));
+ benchLog.AppendLine();
+
+ var depositIds = new HashSet();
+ ICrossChainTransfer[] transfers;
+
+ try
+ {
+ foreach (CrossChainTransferStatus status in new[] { CrossChainTransferStatus.FullySigned, CrossChainTransferStatus.Partial })
+ depositIds.UnionWith(this.depositsIdsByStatus[status]);
+
+ transfers = this.Get(depositIds.ToArray()).Where(t => t != null).ToArray();
+
+ // When sorting, Suspended transactions will have null PartialTransactions. Always put them last in the order they're in.
+ IEnumerable inprogress = transfers.Where(x => x.Status != CrossChainTransferStatus.Suspended && x.Status != CrossChainTransferStatus.Rejected);
+ IEnumerable suspended = transfers.Where(x => x.Status == CrossChainTransferStatus.Suspended || x.Status == CrossChainTransferStatus.Rejected);
+
+ List pendingWithdrawals = this.withdrawalHistoryProvider.GetPendingWithdrawals(inprogress.Concat(suspended));
+
+ if (pendingWithdrawals.Count > 0)
+ {
+ benchLog.AppendLine("--- Pending Withdrawals ---");
+ foreach (WithdrawalModel withdrawal in pendingWithdrawals.Take(TransfersToDisplay))
+ benchLog.AppendLine(withdrawal.ToString());
+
+ if (pendingWithdrawals.Count > TransfersToDisplay)
+ benchLog.AppendLine($"And {pendingWithdrawals.Count - TransfersToDisplay} more...");
+
+ benchLog.AppendLine();
+ }
+ }
+ catch (Exception exception)
+ {
+ benchLog.AppendLine("--- Pending Withdrawals ---");
+ benchLog.AppendLine("Failed to retrieve data");
+ this.logger.LogError("Exception occurred while getting pending withdrawals: '{0}'.", exception.ToString());
+ }
+
+ List completedWithdrawals = GetCompletedWithdrawals(TransfersToDisplay);
+ if (completedWithdrawals.Count > 0)
+ {
+ benchLog.AppendLine("--- Recently Completed Withdrawals ---");
+
+ foreach (WithdrawalModel withdrawal in completedWithdrawals)
+ benchLog.AppendLine(withdrawal.ToString());
+
+ benchLog.AppendLine();
+ }
+ }
+
+ ///
+ public List GetCompletedWithdrawals(int transfersToDisplay)
+ {
+ var depositIds = new HashSet();
+ foreach (CrossChainTransferStatus status in new[] { CrossChainTransferStatus.SeenInBlock })
+ depositIds.UnionWith(this.depositsIdsByStatus[status]);
+
+ ICrossChainTransfer[] transfers = this.Get(depositIds.ToArray()).Where(t => t != null).ToArray();
+
+ return this.withdrawalHistoryProvider.GetHistory(transfers, transfersToDisplay);
+ }
+
///
public void Dispose()
{
diff --git a/src/Stratis.Features.FederatedPeg/TargetChain/MaturedBlocksSyncManager.cs b/src/Stratis.Features.FederatedPeg/TargetChain/MaturedBlocksSyncManager.cs
index 18b34d9ff3..e8464daf48 100644
--- a/src/Stratis.Features.FederatedPeg/TargetChain/MaturedBlocksSyncManager.cs
+++ b/src/Stratis.Features.FederatedPeg/TargetChain/MaturedBlocksSyncManager.cs
@@ -34,9 +34,6 @@ public class MaturedBlocksSyncManager : IMaturedBlocksSyncManager
private IAsyncLoop requestDepositsTask;
- /// The maximum amount of blocks to request at a time from alt chain.
- public const int MaxBlocksToRequest = 1000;
-
/// When we are fully synced we stop asking for more blocks for this amount of time.
private const int RefreshDelaySeconds = 10;
@@ -79,8 +76,6 @@ public async Task StartAsync()
/// true if delay between next time we should ask for blocks is required; false otherwise.
protected async Task SyncDepositsAsync()
{
- this.logger.LogInformation($"Fetching deposits from height {this.crossChainTransferStore.NextMatureDepositHeight}");
-
SerializableResult> model = await this.federationGatewayClient.GetMaturedBlockDepositsAsync(this.crossChainTransferStore.NextMatureDepositHeight, this.nodeLifetime.ApplicationStopping).ConfigureAwait(false);
if (model == null)
diff --git a/src/Stratis.Features.FederatedPeg/TargetChain/MempoolCleaner.cs b/src/Stratis.Features.FederatedPeg/TargetChain/MempoolCleaner.cs
index 93825f8667..e4b97fd60e 100644
--- a/src/Stratis.Features.FederatedPeg/TargetChain/MempoolCleaner.cs
+++ b/src/Stratis.Features.FederatedPeg/TargetChain/MempoolCleaner.cs
@@ -120,7 +120,7 @@ private async Task CleanMempoolAsync()
completedTransactions = this.CompletedTransactions(transactionsToCheck).ToList();
});
- List transactionsToRemove = this.store.CompletedWithdrawals(transactionsToCheck)
+ List transactionsToRemove = this.store.GetCompletedWithdrawalsForTransactions(transactionsToCheck)
.Union(completedTransactions)
.ToList();
diff --git a/src/Stratis.Features.FederatedPeg/TargetChain/SignedMultisigTransactionBroadcaster.cs b/src/Stratis.Features.FederatedPeg/TargetChain/SignedMultisigTransactionBroadcaster.cs
index 2f4ff2ccf4..80937e710d 100644
--- a/src/Stratis.Features.FederatedPeg/TargetChain/SignedMultisigTransactionBroadcaster.cs
+++ b/src/Stratis.Features.FederatedPeg/TargetChain/SignedMultisigTransactionBroadcaster.cs
@@ -120,7 +120,7 @@ private async Task BroadcastFullyS
return transferItem;
}
- this.logger.LogInformation("Broadcasting deposit '{0}', a signed multisig transaction '{1'} to the network.", crossChainTransfer.DepositTransactionId, crossChainTransfer.PartialTransaction.GetHash());
+ this.logger.LogInformation("Broadcasting deposit '{0}', a signed multisig transaction '{1}' to the network.", crossChainTransfer.DepositTransactionId, crossChainTransfer.PartialTransaction.GetHash());
await this.broadcasterManager.BroadcastTransactionAsync(crossChainTransfer.PartialTransaction).ConfigureAwait(false);
diff --git a/src/Stratis.Features.FederatedPeg/TargetChain/WithdrawalHistoryProvider.cs b/src/Stratis.Features.FederatedPeg/TargetChain/WithdrawalHistoryProvider.cs
index 982b2540fa..e6ce3cab39 100644
--- a/src/Stratis.Features.FederatedPeg/TargetChain/WithdrawalHistoryProvider.cs
+++ b/src/Stratis.Features.FederatedPeg/TargetChain/WithdrawalHistoryProvider.cs
@@ -11,56 +11,50 @@ namespace Stratis.Features.FederatedPeg.TargetChain
{
public interface IWithdrawalHistoryProvider
{
- List GetHistory(int maximumEntriesToReturn);
- List GetPending();
+ List GetHistory(IEnumerable crossChainTransfers, int maximumEntriesToReturn);
+ List GetPendingWithdrawals(IEnumerable crossChainTransfers);
}
public class WithdrawalHistoryProvider : IWithdrawalHistoryProvider
{
- private readonly Network network;
private readonly IFederatedPegSettings federatedPegSettings;
- private readonly ICrossChainTransferStore crossChainTransferStore;
- private readonly IWithdrawalExtractor withdrawalExtractor;
private readonly MempoolManager mempoolManager;
+ private readonly Network network;
+ private readonly IWithdrawalExtractor withdrawalExtractor;
///
/// The constructor.
///
/// Network we are running on.
/// Federation settings providing access to number of signatures required.
- /// Store which provides access to the statuses.
/// Mempool which provides information about transactions in the mempool.
/// Logger factory.
/// Counter chain network.
+ ///
public WithdrawalHistoryProvider(
Network network,
IFederatedPegSettings federatedPegSettings,
- ICrossChainTransferStore crossChainTransferStore,
MempoolManager mempoolManager,
ILoggerFactory loggerFactory,
CounterChainNetworkWrapper counterChainNetworkWrapper)
{
this.network = network;
this.federatedPegSettings = federatedPegSettings;
- this.crossChainTransferStore = crossChainTransferStore;
this.withdrawalExtractor = new WithdrawalExtractor(federatedPegSettings, new OpReturnDataReader(loggerFactory, counterChainNetworkWrapper), network);
this.mempoolManager = mempoolManager;
}
- // TODO: These can be more efficient, i.e. remove the wallet calls from GetHistory
- // And use a different model for Withdrawals. It doesn't quite map to the Withdrawal class.
-
///
/// Get the history of successful withdrawals.
///
+ /// The list of transfers to report on.
/// The maximum number of entries to return.
/// A object containing a history of withdrawals.
- public List GetHistory(int maximumEntriesToReturn)
+ public List GetHistory(IEnumerable crossChainTransfers, int maximumEntriesToReturn)
{
var result = new List();
- ICrossChainTransfer[] transfers = this.crossChainTransferStore.GetTransfersByStatus(new[] { CrossChainTransferStatus.SeenInBlock });
- foreach (ICrossChainTransfer transfer in transfers.OrderByDescending(t => t.BlockHeight))
+ foreach (ICrossChainTransfer transfer in crossChainTransfers.OrderByDescending(t => t.BlockHeight))
{
if (maximumEntriesToReturn-- <= 0)
break;
@@ -76,20 +70,13 @@ public List GetHistory(int maximumEntriesToReturn)
///
/// Get pending withdrawals.
///
+ /// The list of transfers to report on.
/// A object containing pending withdrawals and statuses.
- public List GetPending()
+ public List GetPendingWithdrawals(IEnumerable crossChainTransfers)
{
var result = new List();
- // Get all Suspended, all Partial, and all FullySigned transfers.
- ICrossChainTransfer[] inProgressTransfers = this.crossChainTransferStore.GetTransfersByStatus(new CrossChainTransferStatus[]
- {
- CrossChainTransferStatus.Suspended,
- CrossChainTransferStatus.Partial,
- CrossChainTransferStatus.FullySigned
- }, true, false);
-
- foreach (ICrossChainTransfer transfer in inProgressTransfers)
+ foreach (ICrossChainTransfer transfer in crossChainTransfers)
{
var model = new WithdrawalModel(this.network, transfer);
string status = transfer?.Status.ToString();
diff --git a/src/Stratis.Features.FederatedPeg/Wallet/FederationWalletManager.cs b/src/Stratis.Features.FederatedPeg/Wallet/FederationWalletManager.cs
index 0e0fed14d7..a0cf5274df 100644
--- a/src/Stratis.Features.FederatedPeg/Wallet/FederationWalletManager.cs
+++ b/src/Stratis.Features.FederatedPeg/Wallet/FederationWalletManager.cs
@@ -2,16 +2,19 @@
using System.Collections.Generic;
using System.Linq;
using System.Security;
+using System.Text;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using NBitcoin;
using NBitcoin.Policy;
using Stratis.Bitcoin.AsyncWork;
using Stratis.Bitcoin.Configuration;
+using Stratis.Bitcoin.Configuration.Logging;
using Stratis.Bitcoin.Features.Wallet;
using Stratis.Bitcoin.Features.Wallet.Interfaces;
using Stratis.Bitcoin.Interfaces;
using Stratis.Bitcoin.Utilities;
+using Stratis.Features.FederatedPeg.Controllers;
using Stratis.Features.FederatedPeg.Interfaces;
using Stratis.Features.FederatedPeg.TargetChain;
using TracerAttributes;
@@ -120,6 +123,7 @@ public class FederationWalletManager : LockProtected, IFederationWalletManager
public FederationWalletManager(
ILoggerFactory loggerFactory,
Network network,
+ INodeStats nodeStats,
ChainIndexer chainIndexer,
DataFolder dataFolder,
IWalletFeePolicy walletFeePolicy,
@@ -155,6 +159,9 @@ public FederationWalletManager(
this.withdrawalExtractor = withdrawalExtractor;
this.isFederationActive = false;
this.blockStore = blockStore;
+
+ nodeStats.RegisterStats(this.AddComponentStats, StatsType.Component, this.GetType().Name);
+ nodeStats.RegisterStats(this.AddInlineStats, StatsType.Inline, this.GetType().Name, 800);
}
///
@@ -1283,5 +1290,37 @@ private IEnumerable GetSpendableTransactions(int current
return (confirmed, total - confirmed);
}
}
+
+ 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);
+ }
+
+ private void AddComponentStats(StringBuilder benchLog)
+ {
+ benchLog.AppendLine("====== Federation Wallet ======");
+
+ (Money ConfirmedAmount, Money UnConfirmedAmount) = GetSpendableAmount();
+
+ 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();
+
+ if (!this.isFederationActive)
+ {
+ benchLog.AppendLine("".PadRight(59, '=') + " W A R N I N G " + "".PadRight(59, '='));
+ benchLog.AppendLine();
+ benchLog.AppendLine("This federation node is not enabled. You will not be able to store or participate in signing of transactions until you enable it.");
+ benchLog.AppendLine("If not done previously, please enable your federation node using " + $"/api/FederationWallet/{FederationWalletRouteEndPoint.EnableFederation}.");
+ benchLog.AppendLine();
+ benchLog.AppendLine("".PadRight(133, '='));
+ benchLog.AppendLine();
+ }
+ }
}
-}
+}
\ No newline at end of file
diff --git a/src/Stratis.Features.SQLiteWalletRepository/Stratis.Features.SQLiteWalletRepository.csproj b/src/Stratis.Features.SQLiteWalletRepository/Stratis.Features.SQLiteWalletRepository.csproj
index f3f479ae0d..b6046cfa21 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.6.0
+ 1.0.6.1
False
Stratis Group Ltd.
diff --git a/src/Stratis.StraxD/Stratis.StraxD.csproj b/src/Stratis.StraxD/Stratis.StraxD.csproj
index ba7d5ad738..eb88886d05 100644
--- a/src/Stratis.StraxD/Stratis.StraxD.csproj
+++ b/src/Stratis.StraxD/Stratis.StraxD.csproj
@@ -16,7 +16,7 @@
latest
- 1.0.6.0
+ 1.0.6.1
Stratis Group Ltd.
diff --git a/src/Stratis.StraxDnsD/Stratis.StraxDnsD.csproj b/src/Stratis.StraxDnsD/Stratis.StraxDnsD.csproj
index e90b01da81..b026544b73 100644
--- a/src/Stratis.StraxDnsD/Stratis.StraxDnsD.csproj
+++ b/src/Stratis.StraxDnsD/Stratis.StraxDnsD.csproj
@@ -16,7 +16,7 @@
latest
- 1.0.6.0
+ 1.0.6.1
Stratis Group Ltd.