mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-04-22 04:38:55 +02:00
Merge #16399: wallet: Improve wallet creation
e967cae8faUse switch on status in RpcWallet (Fabian Jahr)ba1f128d6cReturn error for ignored passphrase through disable private keys option (Fabian Jahr)d6649d16b5Use strong enum for WalletCreationStatus (Fabian Jahr)3199610ad3Place 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 utACKe967cae8faMarcoFalke: ACKe967cae8faTree-SHA512: 3d12880ff95add9e4a5702afa26ef38080b57b216a608c113a4d0a08ba2d61142c027ba0071c6402add45db90383eee0bada12dc42820dc0d602721d7175edd5
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user