|
3 | 3 | # Distributed under the MIT software license, see the accompanying
|
4 | 4 | # file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
5 | 5 | """Test the scanblocks RPC call."""
|
| 6 | +from test_framework.messages import COIN |
6 | 7 | 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 | +) |
8 | 16 |
|
9 | 17 |
|
10 | 18 | class ScanblocksTest(BitcoinTestFramework):
|
11 | 19 | def set_test_params(self):
|
12 | 20 | self.num_nodes = 2
|
13 | 21 | self.extra_args = [["-blockfilterindex=1"], []]
|
14 | 22 |
|
15 |
| - def skip_test_if_missing_module(self): |
16 |
| - self.skip_if_no_wallet() |
17 |
| - |
18 | 23 | def run_test(self):
|
19 | 24 | node = self.nodes[0]
|
| 25 | + wallet = MiniWallet(node) |
| 26 | + wallet.rescan_utxos() |
| 27 | + |
20 | 28 | # 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) |
23 | 31 |
|
24 | 32 | parent_key = "tpubD6NzVbkrYhZ4WaWSyoBvQwbpLkojyoTZPRsgXELWz3Popb3qkjcJyJUGLnL4qHHoQvao8ESaAstxYSnhyswJ76uZPStJRJCTKvosUCJZL5B"
|
25 | 33 | # send 1.0, mempool only
|
26 | 34 | # 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) |
28 | 38 |
|
29 | 39 | # mine a block and assure that the mined blockhash is in the filterresult
|
30 | 40 | blockhash = self.generate(node, 1)[0]
|
|
0 commit comments