[bitcoin/bitcoin] Add createwallet «disableprivatekeys» option: a sane mode for watchonly-wallets (#9662)

Sjors commented on this pull request.

> InitError(_(«Unable to generate initial keys») += «n»);
return nullptr;

+ } else if ((wallet_creation_flags & WALLET_FLAG_DISABLE_PRIVATE_KEYS)) {
+ // Make it impossible to disable private keys after creation
+ InitError(strprintf(_(«Error loading %s: Private keys can only be disabled during creation»), walletFile));
+ return NULL;
+ } else if (walletInstance->IsWalletFlagSet(WALLET_FLAG_DISABLE_PRIVATE_KEYS)) {
+ LOCK(walletInstance->cs_wallet);
+ if (!walletInstance->mapKeys.empty() || !walletInstance->mapCryptedKeys.empty()) {
+ InitError(strprintf(_(«Error loading %s: Private keys detected in wallet with disabled private keys»), walletFile));

Sounds like that should be a warning, not an error.

Добавить комментарий