diff options
author | Sebastian Falbesoner <sebastian.falbesoner@gmail.com> | 2021-12-27 14:17:42 +0100 |
---|---|---|
committer | Sebastian Falbesoner <sebastian.falbesoner@gmail.com> | 2021-12-27 14:39:22 +0100 |
commit | d2efb66458e5ded38fe15216710de7036fe55244 (patch) | |
tree | 49a77af1a38f7da772311534ef694129c6ad9b42 /test | |
parent | d3582f2d3bfebb32316aa3974f6f27db20a610f5 (diff) |
test: use MiniWallet for p2p_compactblocks.py
This test can now be run even with the Bitcoin Core wallet disabled.
Diffstat (limited to 'test')
-rwxr-xr-x | test/functional/p2p_compactblocks.py | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/test/functional/p2p_compactblocks.py b/test/functional/p2p_compactblocks.py index a314e8edfd..364e806e18 100755 --- a/test/functional/p2p_compactblocks.py +++ b/test/functional/p2p_compactblocks.py @@ -65,6 +65,8 @@ from test_framework.util import ( assert_equal, softfork_active, ) +from test_framework.wallet import MiniWallet + # TestP2PConn: A peer we use to send messages to bitcoind, and store responses. class TestP2PConn(P2PInterface): @@ -150,9 +152,6 @@ class CompactBlocksTest(BitcoinTestFramework): ]] self.utxos = [] - def skip_test_if_missing_module(self): - self.skip_if_no_wallet() - def build_block_on_tip(self, node, segwit=False): block = create_block(tmpl=node.getblocktemplate(NORMAL_GBT_REQUEST_PARAMS)) if segwit: @@ -165,7 +164,7 @@ class CompactBlocksTest(BitcoinTestFramework): block = self.build_block_on_tip(self.nodes[0]) self.segwit_node.send_and_ping(msg_no_witness_block(block)) assert int(self.nodes[0].getbestblockhash(), 16) == block.sha256 - self.generatetoaddress(self.nodes[0], COINBASE_MATURITY, self.nodes[0].getnewaddress(address_type="bech32")) + self.generate(self.wallet, COINBASE_MATURITY) total_value = block.vtx[0].vout[0].nValue out_value = total_value // 10 @@ -296,12 +295,10 @@ class CompactBlocksTest(BitcoinTestFramework): # Generate a bunch of transactions. self.generate(node, COINBASE_MATURITY + 1) num_transactions = 25 - address = node.getnewaddress() segwit_tx_generated = False for _ in range(num_transactions): - txid = node.sendtoaddress(address, 0.1) - hex_tx = node.gettransaction(txid)["hex"] + hex_tx = self.wallet.send_self_transfer(from_node=self.nodes[0])['hex'] tx = tx_from_hex(hex_tx) if not tx.wit.is_null(): segwit_tx_generated = True @@ -843,8 +840,7 @@ class CompactBlocksTest(BitcoinTestFramework): assert_highbandwidth_states(self.nodes[0], hb_to=True, hb_from=False) def run_test(self): - # Get the nodes out of IBD - self.generate(self.nodes[0], 1) + self.wallet = MiniWallet(self.nodes[0]) # Setup the p2p connections self.segwit_node = self.nodes[0].add_p2p_connection(TestP2PConn(cmpct_version=2)) |