Skip to content

Commit fad03cd

Browse files
author
MarcoFalke
committed
test: Check that wallet txs not in the mempool are untrusted
1 parent fa19531 commit fad03cd

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

test/functional/wallet_balance.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ class WalletTest(BitcoinTestFramework):
4141
def set_test_params(self):
4242
self.num_nodes = 2
4343
self.setup_clean_chain = True
44+
self.extra_args = [
45+
['-limitdescendantcount=3'], # Limit mempool descendants as a hack to have wallet txs rejected from the mempool
46+
[],
47+
]
4448

4549
def skip_test_if_missing_module(self):
4650
self.skip_if_no_wallet()
@@ -145,6 +149,13 @@ def test_balances(*, fee_node_1=0):
145149
after = self.nodes[1].getunconfirmedbalance()
146150
assert_equal(before + Decimal('0.1'), after)
147151

152+
# Create 3 more wallet txs, where the last is not accepted to the
153+
# mempool because it is the third descendant of the tx above
154+
for _ in range(3):
155+
txid = self.nodes[0].sendtoaddress(self.nodes[0].getnewaddress(), 99)
156+
assert txid not in self.nodes[0].getrawmempool()
157+
assert_equal(self.nodes[0].getbalance(minconf=0), 0) # wallet txs not in the mempool are untrusted
158+
148159

149160
if __name__ == '__main__':
150161
WalletTest().main()

0 commit comments

Comments
 (0)