public void VerifyThatColdStakeTransactionCanBeFiltered() { this.Initialize(); this.CreateMempoolManager(); this.coldStakingManager.CreateWallet(walletPassword, walletName1, walletPassphrase, new Mnemonic(walletMnemonic1)); Wallet.Wallet wallet1 = this.coldStakingManager.GetWalletByName(walletName1); // This will add a normal account to our wallet. Transaction trx1 = this.AddSpendableTransactionToWallet(wallet1); // This will add a secondary account to our wallet. Transaction trx2 = this.AddSpendableColdstakingTransactionToWallet(wallet1); // THis will add a cold staking transaction to the secondary normal account address. This simulates activation of cold staking onto any normal address. Transaction trx3 = this.AddSpendableColdstakingTransactionToNormalWallet(wallet1); var accounts = wallet1.GetAccounts(Wallet.Wallet.AllAccounts).ToArray(); // We should have 2 accounts in our wallet. Assert.Equal(2, accounts.Length); // But not if we use default or specify to only return normal accounts. Assert.Single(wallet1.GetAccounts().ToArray()); // Defaults to NormalAccounts Assert.Single(wallet1.GetAccounts(Wallet.Wallet.NormalAccounts).ToArray()); // Verify that we actually have an cold staking activation UTXO in the wallet of 202 coins. // This should normally not be returned by the GetAllTransactions, and should never be included in balance calculations. Assert.True(accounts[0].ExternalAddresses.ToArray()[1].Transactions.ToArray()[0].IsColdCoinStake); Assert.Equal(new Money(202, MoneyUnit.BTC), accounts[0].ExternalAddresses.ToArray()[1].Transactions.ToArray()[0].Amount); Assert.Single(wallet1.GetAllTransactions().ToArray()); // Default to NormalAccounts, should filter out cold staking (trx3) from normal wallet. Assert.Single(wallet1.GetAllTransactions(Wallet.Wallet.NormalAccounts).ToArray()); Assert.Single(wallet1.GetAllSpendableTransactions(5, 0, Wallet.Wallet.NormalAccounts).ToArray()); // Default to NormalAccounts Assert.Equal(2, wallet1.GetAllTransactions(Wallet.Wallet.AllAccounts).ToArray().Length); Assert.Equal(2, wallet1.GetAllSpendableTransactions(5, 0, Wallet.Wallet.AllAccounts).ToArray().Length); // Specified AllAccounts, should include cold-staking transaction. // Verify balance on normal account var balance1 = accounts[0].GetBalances(true); var balance2 = accounts[0].GetBalances(false); Assert.Equal(new Money(101, MoneyUnit.BTC), balance1.ConfirmedAmount); Assert.Equal(new Money(303, MoneyUnit.BTC), balance2.ConfirmedAmount); // Verify balance on special account. // Verify balance on normal account var balance3 = accounts[1].GetBalances(true); var balance4 = accounts[1].GetBalances(false); // The only transaction that exists in the cold staking wallet, is a normal one, and should be returned for both balance queries. Assert.Equal(new Money(101, MoneyUnit.BTC), balance3.ConfirmedAmount); Assert.Equal(new Money(101, MoneyUnit.BTC), balance4.ConfirmedAmount); }