Skip to content

Commit cf553e3

Browse files
committed
Merge bitcoin#28597: wallet: No BDB creation, unless -deprecatedrpc=create_bdb
fa071ae wallet: No BDB creation, unless -deprecatedrpc=create_bdb (MarcoFalke) 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. ACKs for top commit: Sjors: tACK fa071ae achow101: ACK fa071ae furszy: utACK fa071ae Tree-SHA512: 37a4c3e4ba659e0ebe2382e71d9c80e42a895d9ad743f5dda7c110fbbb7d2a36f46769982552a9ac0c3a57203379ef164be97aa8033eb7674d6b4da030ba8f9b
2 parents 0b2c93b + fa071ae commit cf553e3

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/wallet/rpc/wallet.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ static RPCHelpMan createwallet()
343343
{"passphrase", RPCArg::Type::STR, RPCArg::Optional::OMITTED, "Encrypt the wallet with this passphrase."},
344344
{"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."},
345345
{"descriptors", RPCArg::Type::BOOL, RPCArg::Default{true}, "Create a native descriptor wallet. The wallet will use descriptors internally to handle address creation."
346-
" Setting to \"false\" will create a legacy wallet; however, the legacy wallet type is being deprecated and"
346+
" Setting to \"false\" will create a legacy wallet; This is only possible with the -deprecatedrpc=create_bdb setting because, the legacy wallet type is being deprecated and"
347347
" support for creating and opening legacy wallets will be removed in the future."},
348348
{"load_on_startup", RPCArg::Type::BOOL, RPCArg::Optional::OMITTED, "Save wallet name to persistent settings and load on startup. True to add wallet to startup list, false to remove, null to leave unchanged."},
349349
{"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."},
@@ -389,11 +389,16 @@ static RPCHelpMan createwallet()
389389
if (!request.params[4].isNull() && request.params[4].get_bool()) {
390390
flags |= WALLET_FLAG_AVOID_REUSE;
391391
}
392-
if (request.params[5].isNull() || request.params[5].get_bool()) {
392+
if (self.Arg<bool>(5)) {
393393
#ifndef USE_SQLITE
394394
throw JSONRPCError(RPC_WALLET_ERROR, "Compiled without sqlite support (required for descriptor wallets)");
395395
#endif
396396
flags |= WALLET_FLAG_DESCRIPTORS;
397+
} else {
398+
if (!context.chain->rpcEnableDeprecated("create_bdb")) {
399+
throw JSONRPCError(RPC_WALLET_ERROR, "BDB wallet creation is deprecated and will be removed in a future release."
400+
" In this release it can be re-enabled temporarily with the -deprecatedrpc=create_bdb setting.");
401+
}
397402
}
398403
if (!request.params[7].isNull() && request.params[7].get_bool()) {
399404
#ifdef ENABLE_EXTERNAL_SIGNER

test/functional/test_framework/util.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,7 @@ def write_config(config_path, *, n, chain, extra_config="", disable_autoconnect=
404404
f.write("upnp=0\n")
405405
f.write("natpmp=0\n")
406406
f.write("shrinkdebugfile=0\n")
407+
f.write("deprecatedrpc=create_bdb\n") # Required to run the tests
407408
# To improve SQLite wallet performance so that the tests don't timeout, use -unsafesqlitesync
408409
f.write("unsafesqlitesync=1\n")
409410
if disable_autoconnect:

0 commit comments

Comments
 (0)