Skip to content

Commit 23ac20e

Browse files
committed
Merge bitcoin#28597: wallet: No BDB creation, unless -deprecatedrpc=create_bdb
fa071ae wallet: No BDB creation, unless -deprecatedrpc=create_bdb (MarcoFalke) Bitcoin Pull request description: With BDB being removed soon, it seems confusing and harmful to allow users to create fresh BDB wallets going forward, as it would load them with an additional burden of having to migrate them soon after. Also, it would be good to allow for one release for test (and external) scripts to adapt. Fix all issues by introducing the `-deprecatedrpc=create_bdb` setting.
1 parent c352c19 commit 23ac20e

2 files changed

Lines changed: 11 additions & 2 deletions

File tree

src/wallet/rpc/wallet.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -634,7 +634,9 @@ static RPCHelpMan createwallet()
634634
{"blank", RPCArg::Type::BOOL, RPCArg::Default{false}, "Create a blank wallet. A blank wallet has no keys or HD seed. One can be set using upgradetohd (by mnemonic) or sethdseed (WIF private key)."},
635635
{"passphrase", RPCArg::Type::STR, RPCArg::Optional::OMITTED_NAMED_ARG, "Encrypt the wallet with this passphrase."},
636636
{"avoid_reuse", RPCArg::Type::BOOL, RPCArg::Default{false}, "Keep track of coin reuse, and treat dirty and clean coins differently with privacy considerations in mind."},
637-
{"descriptors", RPCArg::Type::BOOL, RPCArg::Default{true}, "Create a native descriptor wallet. The wallet will use descriptors internally to handle address creation."},
637+
{"descriptors", RPCArg::Type::BOOL, RPCArg::Default{true}, "Create a native descriptor wallet. The wallet will use descriptors internally to handle address creation."
638+
" Setting this to \"false\" creates a legacy wallet. This is only possible with -deprecatedrpc=create_bdb, because legacy wallet creation is deprecated and"
639+
" support for creating and opening legacy wallets will be removed in a future release."},
638640
{"load_on_startup", RPCArg::Type::BOOL, RPCArg::Optional::OMITTED_NAMED_ARG, "Save wallet name to persistent settings and load on startup. True to add wallet to startup list, false to remove, null to leave unchanged."},
639641
{"external_signer", RPCArg::Type::BOOL, RPCArg::Default{false}, "Use an external signer such as a hardware wallet. Requires -signer to be configured. Wallet creation will fail if keys cannot be fetched. Requires disable_private_keys and descriptors set to true."},
640642
},
@@ -679,11 +681,17 @@ static RPCHelpMan createwallet()
679681
if (!request.params[5].isNull() && request.params[6].isNull()) {
680682
throw JSONRPCError(RPC_INVALID_PARAMETER, "The createwallet RPC requires specifying the 'load_on_startup' flag when param 'descriptors' is specified. Dash Core v21 introduced this requirement due to breaking changes in the createwallet RPC.");
681683
}
682-
if (request.params[5].isNull() || request.params[5].get_bool()) {
684+
if (request.params[5].isNull() || request.params[5].get_bool())
685+
{
683686
#ifndef USE_SQLITE
684687
throw JSONRPCError(RPC_WALLET_ERROR, "Compiled without sqlite support (required for descriptor wallets)");
685688
#endif
686689
flags |= WALLET_FLAG_DESCRIPTORS;
690+
} else {
691+
if (!context.chain->rpcEnableDeprecated("create_bdb")) {
692+
throw JSONRPCError(RPC_WALLET_ERROR, "BDB wallet creation is deprecated and will be removed in a future release."
693+
" In this release it can be re-enabled temporarily with the -deprecatedrpc=create_bdb setting.");
694+
}
687695
}
688696
if (!request.params[7].isNull() && request.params[7].get_bool()) {
689697
#ifdef ENABLE_EXTERNAL_SIGNER

test/functional/test_framework/util.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,7 @@ def write_config(config_path, *, n, chain, extra_config="", disable_autoconnect=
419419
f.write("upnp=0\n")
420420
f.write("natpmp=0\n")
421421
f.write("shrinkdebugfile=0\n")
422+
f.write("deprecatedrpc=create_bdb\n") # Required to run the tests
422423
# To reduce IO and consumed disk storage use tiny size for allocated blk and rev files
423424
f.write("tinyblk=1\n")
424425
# To improve SQLite wallet performance so that the tests don't timeout, use -unsafesqlitesync

0 commit comments

Comments
 (0)