Skip to content

Commit 3f1f5f6

Browse files
author
MacroFake
committed
Merge bitcoin/bitcoin#26307: test: use MiniWallet for rpc_scanblocks.py
ae3626e test: use MiniWallet for rpc_scanblocks.py (Sebastian Falbesoner) Pull request description: This is a small follow-up for #23549 which introduced `scanblocks`. Since that RPC doesn't need the wallet, we can switch the functional test to use MiniWallet. ACKs for top commit: MarcoFalke: review ACK ae3626e Tree-SHA512: e0b0088103e059b29719299c58fd5173b1cff58cb73025a9a33ad493cd0ac50ba25a5f790e471c00a09b4dca80f3c011174ca4e0c8f34746c39831f5823dc8ba
2 parents 3b85e17 + ae3626e commit 3f1f5f6

File tree

1 file changed

+17
-7
lines changed

1 file changed

+17
-7
lines changed

test/functional/rpc_scanblocks.py

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,38 @@
33
# Distributed under the MIT software license, see the accompanying
44
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
55
"""Test the scanblocks RPC call."""
6+
from test_framework.messages import COIN
67
from test_framework.test_framework import BitcoinTestFramework
7-
from test_framework.util import assert_equal, assert_raises_rpc_error
8+
from test_framework.util import (
9+
assert_equal,
10+
assert_raises_rpc_error,
11+
)
12+
from test_framework.wallet import (
13+
MiniWallet,
14+
getnewdestination,
15+
)
816

917

1018
class ScanblocksTest(BitcoinTestFramework):
1119
def set_test_params(self):
1220
self.num_nodes = 2
1321
self.extra_args = [["-blockfilterindex=1"], []]
1422

15-
def skip_test_if_missing_module(self):
16-
self.skip_if_no_wallet()
17-
1823
def run_test(self):
1924
node = self.nodes[0]
25+
wallet = MiniWallet(node)
26+
wallet.rescan_utxos()
27+
2028
# send 1.0, mempool only
21-
addr_1 = node.getnewaddress()
22-
node.sendtoaddress(addr_1, 1.0)
29+
_, spk_1, addr_1 = getnewdestination()
30+
wallet.send_to(from_node=node, scriptPubKey=spk_1, amount=1 * COIN)
2331

2432
parent_key = "tpubD6NzVbkrYhZ4WaWSyoBvQwbpLkojyoTZPRsgXELWz3Popb3qkjcJyJUGLnL4qHHoQvao8ESaAstxYSnhyswJ76uZPStJRJCTKvosUCJZL5B"
2533
# send 1.0, mempool only
2634
# childkey 5 of `parent_key`
27-
node.sendtoaddress("mkS4HXoTYWRTescLGaUTGbtTTYX5EjJyEE", 1.0)
35+
wallet.send_to(from_node=node,
36+
scriptPubKey=bytes.fromhex(node.validateaddress("mkS4HXoTYWRTescLGaUTGbtTTYX5EjJyEE")['scriptPubKey']),
37+
amount=1 * COIN)
2838

2939
# mine a block and assure that the mined blockhash is in the filterresult
3040
blockhash = self.generate(node, 1)[0]

0 commit comments

Comments
 (0)