Skip to content

Commit eb08560

Browse files
test: add abortrescan RPC test
1 parent 9eeee7c commit eb08560

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

test/functional/test_runner.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,7 @@
393393
'rpc_mempool_info.py',
394394
'rpc_help.py',
395395
'feature_dirsymlinks.py',
396+
'wallet_abortrescan.py --descriptors',
396397
'feature_help.py',
397398
'feature_shutdown.py',
398399
'wallet_migration.py',

test/functional/wallet_abortrescan.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/usr/bin/env python3
2+
# Copyright (c) 2024-present The Bitcoin Core developers
3+
# Distributed under the MIT software license, see the accompanying
4+
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
5+
"""Test Abort Wallet Rescan methods."""
6+
from test_framework.test_framework import BitcoinTestFramework
7+
from test_framework.util import (
8+
assert_equal,
9+
)
10+
11+
class AbortRescanTest(BitcoinTestFramework):
12+
def set_test_params(self):
13+
self.num_nodes = 1
14+
15+
def skip_test_if_missing_module(self):
16+
self.skip_if_no_wallet()
17+
18+
def add_options(self, options):
19+
self.add_wallet_options(options)
20+
21+
def run_test(self):
22+
node_0 = self.nodes[0]
23+
24+
node_0.createwallet(wallet_name="w_0")
25+
w_0 = self.nodes[0].get_wallet_rpc("w_0")
26+
27+
self.log.info('Testing abortrescan when no rescan is in progress')
28+
assert_equal(w_0.getwalletinfo()['scanning'], False)
29+
assert_equal(w_0.abortrescan(), False)
30+
31+
# TODO: test abortrescan while rescanning the blockchain
32+
33+
if __name__ == '__main__':
34+
AbortRescanTest().main()

0 commit comments

Comments
 (0)