Inside Bitcoin
Opening the selected file…
Inside Bitcoin
Opening the selected file…
The code behind the network, with room to understand it.
Release published 2026-10-28 · Snapshot fetched 2026-11-01. Latest stable release at fetch time; development branches and Git history are excluded. Only the selected code window and visible folders load here.
1#!/usr/bin/env python32# Copyright (c) 2022-present The Bitcoin Core developers3# Distributed under the MIT software license, see the accompanying4# file COPYING or https://www.opensource.org/licenses/mit-license.php.7from test_framework.test_framework import BitcoinTestFramework8from test_framework.address import (9ADDRESS_BCRT1_UNSPENDABLE_DESCRIPTOR,10)11from test_framework.util import (12assert_equal,13)16class WalletBlankTest(BitcoinTestFramework):17def set_test_params(self):18self.num_nodes = 120def skip_test_if_missing_module(self):21self.skip_if_no_wallet()23def test_importdescriptors(self):24self.log.info("Test that importdescriptors preserves the blank flag")25self.nodes[0].createwallet(wallet_name="idesc", disable_private_keys=True, blank=True)26wallet = self.nodes[0].get_wallet_rpc("idesc")27info = wallet.getwalletinfo()28assert_equal(info["descriptors"], True)29assert_equal(info["blank"], True)30wallet.importdescriptors([{31"desc": ADDRESS_BCRT1_UNSPENDABLE_DESCRIPTOR,32"timestamp": "now",33}])34assert_equal(wallet.getwalletinfo()["blank"], True)36def test_encrypt_descriptors(self):37self.log.info("Test that encrypting a blank descriptor wallet preserves the blank flag and descriptors remain the same")38self.nodes[0].createwallet(wallet_name="encblankdesc", blank=True)39wallet = self.nodes[0].get_wallet_rpc("encblankdesc")41info = wallet.getwalletinfo()42assert_equal(info["descriptors"], True)43assert_equal(info["blank"], True)44descs = wallet.listdescriptors()46wallet.encryptwallet("pass")47assert_equal(wallet.getwalletinfo()["blank"], True)48assert_equal(descs, wallet.listdescriptors())50def run_test(self):51self.test_importdescriptors()52self.test_encrypt_descriptors()55if __name__ == '__main__':56WalletBlankTest(__file__).main()
Independent explanations by MyBitcoinExplorer. Not affiliated with or endorsed by Bitcoin Core. Guides are educational and do not replace the source or its tests.
Bitcoin Core source © its contributors, distributed under the MIT license. Original notices and bundled third-party licenses are retained in the source tree.