diff --git a/src/Blockcore.Features.ColdStaking.Tests/ColdStakingControllerTest.cs b/src/Blockcore.Features.ColdStaking.Tests/ColdStakingControllerTest.cs
index 19ae21f5f..6a2519873 100644
--- a/src/Blockcore.Features.ColdStaking.Tests/ColdStakingControllerTest.cs
+++ b/src/Blockcore.Features.ColdStaking.Tests/ColdStakingControllerTest.cs
@@ -544,6 +544,45 @@ public void SetupColdStakingWithHotWalletSucceeds()
Assert.True(this.mempoolManager.Validator.AcceptToMemoryPool(state, transaction).GetAwaiter().GetResult(), "Transaction failed mempool validation.");
}
+ ///
+ /// Verify that the ScriptPubKey can be check with the script template.
+ ///
+ [Fact]
+ public void VerifyThatColdStakeTransactionCanBeFiltered()
+ {
+ this.Initialize();
+ this.CreateMempoolManager();
+
+ this.coldStakingManager.CreateWallet(walletPassword, walletName1, walletPassphrase, new Mnemonic(walletMnemonic1));
+
+ Wallet.Wallet wallet1 = this.coldStakingManager.GetWalletByName(walletName1);
+
+ Transaction prevTran = this.AddSpendableTransactionToWallet(wallet1);
+
+ IActionResult result = this.coldStakingController.SetupColdStaking(new SetupColdStakingRequest
+ {
+ HotWalletAddress = hotWalletAddress1,
+ ColdWalletAddress = coldWalletAddress2,
+ WalletName = walletName1,
+ WalletAccount = walletAccount,
+ WalletPassword = walletPassword,
+ Amount = "100",
+ Fees = "0.01"
+ });
+
+ var jsonResult = Assert.IsType(result);
+ var response = Assert.IsType(jsonResult.Value);
+ var transaction = Assert.IsType(this.Network.CreateTransaction(response.TransactionHex));
+
+ Assert.Equal("OP_DUP OP_HASH160 OP_ROT OP_IF OP_CHECKCOLDSTAKEVERIFY 90c582cb91d6b6d777c31c891d4943fed4edac3a OP_ELSE 92dfb829d31cefe6a0731f3432dea41596a278d9 OP_ENDIF OP_EQUALVERIFY OP_CHECKSIG", transaction.Outputs[1].ScriptPubKey.ToString());
+
+ // Get the ColdStaking script template if available.
+ Dictionary templates = this.coldStakingManager.GetValidStakingTemplates();
+ ScriptTemplate coldStakingTemplate = templates["ColdStaking"];
+
+ Assert.True(coldStakingTemplate.CheckScriptPubKey(transaction.Outputs[1].ScriptPubKey));
+ }
+
///
/// Confirms that cold staking setup with the hot wallet will succeed if no issues (as per above test cases) are encountered.
///
diff --git a/src/Blockcore.Features.Wallet/WalletRPCController.cs b/src/Blockcore.Features.Wallet/WalletRPCController.cs
index 0ae37f61b..17175145b 100644
--- a/src/Blockcore.Features.Wallet/WalletRPCController.cs
+++ b/src/Blockcore.Features.Wallet/WalletRPCController.cs
@@ -419,9 +419,19 @@ public GetTransactionModel GetTransaction(string txid)
}
}
+ // Get the ColdStaking script template if available.
+ Dictionary templates = this.walletManager.GetValidStakingTemplates();
+ ScriptTemplate coldStakingTemplate = templates.ContainsKey("ColdStaking") ? templates["ColdStaking"] : null;
+
// Receive transactions details.
foreach (TransactionData trxInWallet in receivedTransactions)
{
+ // Skip the details if the script pub key is cold staking.
+ if (coldStakingTemplate != null && coldStakingTemplate.CheckScriptPubKey(trxInWallet.ScriptPubKey))
+ {
+ continue;
+ }
+
GetTransactionDetailsCategoryModel category;
if (isGenerated)
{