Skip to content

Commit

Permalink
test: add abortrescan RPC test
Browse files Browse the repository at this point in the history
  • Loading branch information
BrandonOdiwuor committed Feb 10, 2024
1 parent 7dc0442 commit dcd2d0f
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
1 change: 1 addition & 0 deletions test/functional/test_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,7 @@
'rpc_mempool_info.py',
'rpc_help.py',
'feature_dirsymlinks.py',
'wallet_abortrescan.py --descriptors'
'feature_help.py',
'feature_shutdown.py',
'wallet_migration.py',
Expand Down
37 changes: 37 additions & 0 deletions test/functional/wallet_abortrescan.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/usr/bin/env python3
# Copyright (c) 2024-present The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test Abort Wallet Rescan methods."""
from test_framework.test_framework import BitcoinTestFramework
from test_framework.blocktools import (
COINBASE_MATURITY,
)
from test_framework.util import (
assert_equal,
)

class AbortRescanTest(BitcoinTestFramework):
def set_test_params(self):
self.num_nodes = 1

def skip_test_if_missing_module(self):
self.skip_if_no_wallet()

def add_options(self, options):
self.add_wallet_options(options)

def run_test(self):
node_0 = self.nodes[0]

node_0.createwallet(wallet_name="w_0")
w_0 = self.nodes[0].get_wallet_rpc("w_0")

self.log.info('Testing abortrescan when no rescan is in progress')
assert_equal(w_0.getwalletinfo()['scanning'], False)
assert_equal(w_0.abortrescan(), False)

# TODO: test abortrescan while rescanning the blockchain

if __name__ == '__main__':
AbortRescanTest().main()

0 comments on commit dcd2d0f

Please sign in to comment.