From 4b209392ce4565d969fd6c62801ce0ef2ed8b2e5 Mon Sep 17 00:00:00 2001 From: Brandon Odiwuor Date: Sat, 10 Feb 2024 11:26:34 +0300 Subject: [PATCH] test: add abortrescan RPC test --- test/functional/test_runner.py | 1 + test/functional/wallet_abortrescan.py | 34 +++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100755 test/functional/wallet_abortrescan.py diff --git a/test/functional/test_runner.py b/test/functional/test_runner.py index dec3087a1288e7..5c4d57abd8680d 100755 --- a/test/functional/test_runner.py +++ b/test/functional/test_runner.py @@ -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', diff --git a/test/functional/wallet_abortrescan.py b/test/functional/wallet_abortrescan.py new file mode 100755 index 00000000000000..cdc7179ddac968 --- /dev/null +++ b/test/functional/wallet_abortrescan.py @@ -0,0 +1,34 @@ +#!/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.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()