Skip to content

Commit a7599c8

Browse files
committed
test: run mempool_compatibility.py even with wallet disabled
1 parent 143bd10 commit a7599c8

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

test/functional/mempool_compatibility.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@
1616
import os
1717

1818
from test_framework.test_framework import BitcoinTestFramework
19+
from test_framework.wallet import MiniWallet
1920

2021

2122
class MempoolCompatibilityTest(BitcoinTestFramework):
2223
def set_test_params(self):
2324
self.num_nodes = 2
24-
self.wallet_names = [None, self.default_wallet_name]
25+
self.wallet_names = [None]
2526

2627
def skip_test_if_missing_module(self):
27-
self.skip_if_no_wallet()
2828
self.skip_if_no_previous_releases()
2929

3030
def setup_network(self):
@@ -38,8 +38,15 @@ def setup_network(self):
3838
def run_test(self):
3939
self.log.info("Test that mempool.dat is compatible between versions")
4040

41-
old_node = self.nodes[0]
42-
new_node = self.nodes[1]
41+
old_node, new_node = self.nodes
42+
new_wallet = MiniWallet(new_node)
43+
new_wallet.generate(1)
44+
new_node.generate(100)
45+
# Sync the nodes to ensure old_node has the block that contains the coinbase that new_wallet will spend.
46+
# Otherwise, because coinbases are only valid in a block and not as loose txns, if the nodes aren't synced
47+
# unbroadcasted_tx won't pass old_node's `MemPoolAccept::PreChecks`.
48+
self.connect_nodes(0, 1)
49+
self.sync_blocks()
4350
recipient = old_node.getnewaddress()
4451
self.stop_node(1)
4552

@@ -58,7 +65,7 @@ def run_test(self):
5865
assert old_tx_hash in new_node.getrawmempool()
5966

6067
self.log.info("Add unbroadcasted tx to mempool on new node and shutdown")
61-
unbroadcasted_tx_hash = new_node.sendtoaddress(recipient, 0.0001)
68+
unbroadcasted_tx_hash = new_wallet.send_self_transfer(from_node=new_node)['txid']
6269
assert unbroadcasted_tx_hash in new_node.getrawmempool()
6370
mempool = new_node.getrawmempool(True)
6471
assert mempool[unbroadcasted_tx_hash]['unbroadcast']

0 commit comments

Comments
 (0)