aboutsummaryrefslogtreecommitdiff
path: root/test/functional/wallet_createwallet.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/functional/wallet_createwallet.py')
-rwxr-xr-xtest/functional/wallet_createwallet.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/functional/wallet_createwallet.py b/test/functional/wallet_createwallet.py
index 8ec4b98b6e..fc7969ad19 100755
--- a/test/functional/wallet_createwallet.py
+++ b/test/functional/wallet_createwallet.py
@@ -96,5 +96,28 @@ class CreateWalletTest(BitcoinTestFramework):
assert_raises_rpc_error(-4, "Error: This wallet has no available keys", w5.getnewaddress)
assert_raises_rpc_error(-4, "Error: This wallet has no available keys", w5.getrawchangeaddress)
+ self.log.info('New blank and encrypted wallets can be created')
+ self.nodes[0].createwallet(wallet_name='wblank', disable_private_keys=False, blank=True, passphrase='thisisapassphrase')
+ wblank = node.get_wallet_rpc('wblank')
+ assert_raises_rpc_error(-13, "Error: Please enter the wallet passphrase with walletpassphrase first.", wblank.signmessage, "needanargument", "test")
+ wblank.walletpassphrase('thisisapassphrase', 10)
+ assert_raises_rpc_error(-4, "Error: This wallet has no available keys", wblank.getnewaddress)
+ assert_raises_rpc_error(-4, "Error: This wallet has no available keys", wblank.getrawchangeaddress)
+
+ self.log.info('Test creating a new encrypted wallet.')
+ # Born encrypted wallet is created (has keys)
+ self.nodes[0].createwallet(wallet_name='w6', disable_private_keys=False, blank=False, passphrase='thisisapassphrase')
+ w6 = node.get_wallet_rpc('w6')
+ assert_raises_rpc_error(-13, "Error: Please enter the wallet passphrase with walletpassphrase first.", w6.signmessage, "needanargument", "test")
+ w6.walletpassphrase('thisisapassphrase', 10)
+ w6.signmessage(w6.getnewaddress('', 'legacy'), "test")
+ w6.keypoolrefill(1)
+ # There should only be 1 key
+ walletinfo = w6.getwalletinfo()
+ assert_equal(walletinfo['keypoolsize'], 1)
+ assert_equal(walletinfo['keypoolsize_hd_internal'], 1)
+ # Empty passphrase, error
+ assert_raises_rpc_error(-16, 'Cannot encrypt a wallet with a blank password', self.nodes[0].createwallet, 'w7', False, False, '')
+
if __name__ == '__main__':
CreateWalletTest().main()