From fad03cd0469c359e14a85bc98eea8a1e1379bd3e Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Fri, 5 Apr 2019 15:26:00 -0400 Subject: [PATCH] test: Check that wallet txs not in the mempool are untrusted --- test/functional/wallet_balance.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/functional/wallet_balance.py b/test/functional/wallet_balance.py index 3b2aa132b..65a6eda1c 100755 --- a/test/functional/wallet_balance.py +++ b/test/functional/wallet_balance.py @@ -41,6 +41,10 @@ class WalletTest(BitcoinTestFramework): def set_test_params(self): self.num_nodes = 2 self.setup_clean_chain = True + self.extra_args = [ + ['-limitdescendantcount=3'], # Limit mempool descendants as a hack to have wallet txs rejected from the mempool + [], + ] def skip_test_if_missing_module(self): self.skip_if_no_wallet() @@ -145,6 +149,13 @@ class WalletTest(BitcoinTestFramework): after = self.nodes[1].getunconfirmedbalance() assert_equal(before + Decimal('0.1'), after) + # Create 3 more wallet txs, where the last is not accepted to the + # mempool because it is the third descendant of the tx above + for _ in range(3): + txid = self.nodes[0].sendtoaddress(self.nodes[0].getnewaddress(), 99) + assert txid not in self.nodes[0].getrawmempool() + assert_equal(self.nodes[0].getbalance(minconf=0), 0) # wallet txs not in the mempool are untrusted + if __name__ == '__main__': WalletTest().main()