diff options
author | Andrew Chow <achow101-github@achow101.com> | 2019-02-06 21:26:55 -0500 |
---|---|---|
committer | Andrew Chow <achow101-github@achow101.com> | 2019-02-10 12:24:53 -0500 |
commit | 7687f7873b75c3cbdfa15ab570211dc39d24ab80 (patch) | |
tree | 2bbbc90f6c961ae1e6005be6584c63d94d721653 /test/functional/wallet_disableprivatekeys.py | |
parent | 5c99bb00470057f573f1d76b76e744a6ccd65b08 (diff) | |
download | bitcoin-7687f7873b75c3cbdfa15ab570211dc39d24ab80.tar.xz |
[wallet] Support creating a blank wallet
A blank wallet is a wallet that has no keys, script or watch only things.
A new wallet flag indicating that it is blank will be set when the wallet
is blank. Once it is no longer blank (a seed has been generated, keys or
scripts imported, etc), the flag will be unset.
Diffstat (limited to 'test/functional/wallet_disableprivatekeys.py')
-rwxr-xr-x | test/functional/wallet_disableprivatekeys.py | 46 |
1 files changed, 0 insertions, 46 deletions
diff --git a/test/functional/wallet_disableprivatekeys.py b/test/functional/wallet_disableprivatekeys.py deleted file mode 100755 index e55bb82e76..0000000000 --- a/test/functional/wallet_disableprivatekeys.py +++ /dev/null @@ -1,46 +0,0 @@ -#!/usr/bin/env python3 -# Copyright (c) 2018 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 disable-privatekeys mode. -""" - -from test_framework.test_framework import BitcoinTestFramework -from test_framework.util import ( - assert_equal, - assert_raises_rpc_error, -) - - -class DisablePrivateKeysTest(BitcoinTestFramework): - def set_test_params(self): - self.setup_clean_chain = False - self.num_nodes = 1 - self.supports_cli = True - - def skip_test_if_missing_module(self): - self.skip_if_no_wallet() - - def run_test(self): - node = self.nodes[0] - self.log.info("Test disableprivatekeys creation.") - self.nodes[0].createwallet('w1', True) - self.nodes[0].createwallet('w2') - w1 = node.get_wallet_rpc('w1') - w2 = node.get_wallet_rpc('w2') - assert_raises_rpc_error(-4,"Error: Private keys are disabled for this wallet", w1.getnewaddress) - assert_raises_rpc_error(-4,"Error: Private keys are disabled for this wallet", w1.getrawchangeaddress) - w1.importpubkey(w2.getaddressinfo(w2.getnewaddress())['pubkey']) - - self.log.info('Test that private keys cannot be imported') - addr = w2.getnewaddress('', 'legacy') - privkey = w2.dumpprivkey(addr) - assert_raises_rpc_error(-4, 'Cannot import private keys to a wallet with private keys disabled', w1.importprivkey, privkey) - result = w1.importmulti([{'scriptPubKey': {'address': addr}, 'timestamp': 'now', 'keys': [privkey]}]) - assert(not result[0]['success']) - assert('warning' not in result[0]) - assert_equal(result[0]['error']['code'], -4) - assert_equal(result[0]['error']['message'], 'Cannot import private keys to a wallet with private keys disabled') - -if __name__ == '__main__': - DisablePrivateKeysTest().main() |