Skip to content

Commit ce90f0c

Browse files
rpc, wallet, refactor: Remove non-descriptor errors
It is not possible to load a legacy/ non-descriptor wallet anymore so no need to check for WALLET_FLAG_DESCRIPTORS in RPC calls, even when passing -rpcwallet/ JSON `/wallet/<walletname>/` endpoint, that searches for the wallets loaded already in the context.
1 parent 573bcd7 commit ce90f0c

File tree

2 files changed

+0
-18
lines changed

2 files changed

+0
-18
lines changed

src/wallet/rpc/backup.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -356,11 +356,6 @@ RPCHelpMan importdescriptors()
356356
// the user could have gotten from another RPC command prior to now
357357
wallet.BlockUntilSyncedToCurrentChain();
358358

359-
// Make sure wallet is a descriptor wallet
360-
if (!pwallet->IsWalletFlagSet(WALLET_FLAG_DESCRIPTORS)) {
361-
throw JSONRPCError(RPC_WALLET_ERROR, "importdescriptors is not available for non-descriptor wallets");
362-
}
363-
364359
WalletRescanReserver reserver(*pwallet);
365360
if (!reserver.reserve(/*with_passphrase=*/true)) {
366361
throw JSONRPCError(RPC_WALLET_ERROR, "Wallet is currently rescanning. Abort existing rescan or wait.");
@@ -493,10 +488,6 @@ RPCHelpMan listdescriptors()
493488
const std::shared_ptr<const CWallet> wallet = GetWalletForJSONRPCRequest(request);
494489
if (!wallet) return UniValue::VNULL;
495490

496-
if (!wallet->IsWalletFlagSet(WALLET_FLAG_DESCRIPTORS)) {
497-
throw JSONRPCError(RPC_WALLET_ERROR, "listdescriptors is not available for non-descriptor wallets");
498-
}
499-
500491
const bool priv = !request.params[0].isNull() && request.params[0].get_bool();
501492
if (priv) {
502493
EnsureWalletIsUnlocked(*wallet);

src/wallet/rpc/wallet.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -763,10 +763,6 @@ RPCHelpMan gethdkeys()
763763
const std::shared_ptr<const CWallet> wallet = GetWalletForJSONRPCRequest(request);
764764
if (!wallet) return UniValue::VNULL;
765765

766-
if (!wallet->IsWalletFlagSet(WALLET_FLAG_DESCRIPTORS)) {
767-
throw JSONRPCError(RPC_WALLET_ERROR, "gethdkeys is not available for non-descriptor wallets");
768-
}
769-
770766
LOCK(wallet->cs_wallet);
771767

772768
UniValue options{request.params[0].isNull() ? UniValue::VOBJ : request.params[0]};
@@ -865,11 +861,6 @@ static RPCHelpMan createwalletdescriptor()
865861
std::shared_ptr<CWallet> const pwallet = GetWalletForJSONRPCRequest(request);
866862
if (!pwallet) return UniValue::VNULL;
867863

868-
// Make sure wallet is a descriptor wallet
869-
if (!pwallet->IsWalletFlagSet(WALLET_FLAG_DESCRIPTORS)) {
870-
throw JSONRPCError(RPC_WALLET_ERROR, "createwalletdescriptor is not available for non-descriptor wallets");
871-
}
872-
873864
std::optional<OutputType> output_type = ParseOutputType(request.params[0].get_str());
874865
if (!output_type) {
875866
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, strprintf("Unknown address type '%s'", request.params[0].get_str()));

0 commit comments

Comments
 (0)