aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2019-07-29 09:36:49 -0400
committerMarcoFalke <falke.marco@gmail.com>2019-07-29 09:36:55 -0400
commit74ea1f3b0f268b0272f8b3548c736dc60f442f78 (patch)
tree315763a81ece963b7f0a76e0818353134a1caedd /test
parent29220250c10ece3f61581225701fe1334d6a6b43 (diff)
parente967cae8fac84ec7a89a3a853a83d8193ac3308e (diff)
downloadbitcoin-74ea1f3b0f268b0272f8b3548c736dc60f442f78.tar.xz
Merge #16399: wallet: Improve wallet creation
e967cae8fac84ec7a89a3a853a83d8193ac3308e Use switch on status in RpcWallet (Fabian Jahr) ba1f128d6c117a63d5d904b3956551bd83405ec9 Return error for ignored passphrase through disable private keys option (Fabian Jahr) d6649d16b57e20b05075f1c80d0de7ff32cca1a4 Use strong enum for WalletCreationStatus (Fabian Jahr) 3199610ad3b93b849f2cb55a8ed3a39a32bbdffc Place out args at the end for CreateWallet (Fabian Jahr) Pull request description: This is a follow-up PR to #16244 The following suggestions are included: - Usage of `enum class` (https://github.com/bitcoin/bitcoin/pull/16244#discussion_r296434142) - Placing out args at the end convention (https://github.com/bitcoin/bitcoin/pull/16244#discussion_r296434172) - Return error when passphrase would be ignored because of disabled private keys (including functional test) (https://github.com/bitcoin/bitcoin/pull/16244#pullrequestreview-252015195) - Make `status` return variable of `CreateWallet` (https://github.com/bitcoin/bitcoin/pull/16244#discussion_r302107394) - Using a `switch` statement instead of `if/else` in `RpcWallet` (https://github.com/bitcoin/bitcoin/pull/16244#discussion_r302112502) Not included was: - "new create wallet function [could take] separate option arguments instead of wallet flags" (https://github.com/bitcoin/bitcoin/pull/16244#pullrequestreview-252015195) - "blank wallet and disable private keys options could be combined into a single option" (https://github.com/bitcoin/bitcoin/pull/16244#pullrequestreview-252015195) For these last two changes, I was not sure what an ideal solution could look like and/or this might be of slightly larger scope than the other changes, but I would be happy to work on these as well in this PR or another follow-up if I get positive feedback on that. Is there a place in the codebase that handles flags like these in a better way that I can refer to? Nonetheless, I would prefer keeping it in a separate PR unless it is a really simple change. ACKs for top commit: jnewbery: Code review utACK e967cae8fac84ec7a89a3a853a83d8193ac3308e MarcoFalke: ACK e967cae8fa Tree-SHA512: 3d12880ff95add9e4a5702afa26ef38080b57b216a608c113a4d0a08ba2d61142c027ba0071c6402add45db90383eee0bada12dc42820dc0d602721d7175edd5
Diffstat (limited to 'test')
-rwxr-xr-xtest/functional/wallet_createwallet.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/test/functional/wallet_createwallet.py b/test/functional/wallet_createwallet.py
index c17949a2f6..294f90a0fa 100755
--- a/test/functional/wallet_createwallet.py
+++ b/test/functional/wallet_createwallet.py
@@ -119,5 +119,8 @@ class CreateWalletTest(BitcoinTestFramework):
# Empty passphrase, error
assert_raises_rpc_error(-16, 'Cannot encrypt a wallet with a blank password', self.nodes[0].createwallet, 'w7', False, False, '')
+ self.log.info('Using a passphrase with private keys disabled returns error')
+ assert_raises_rpc_error(-4, 'Passphrase provided but private keys are disabled. A passphrase is only used to encrypt private keys, so cannot be used for wallets with private keys disabled.', self.nodes[0].createwallet, wallet_name='w8', disable_private_keys=True, passphrase='thisisapassphrase')
+
if __name__ == '__main__':
CreateWalletTest().main()