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.
This commit is contained in:
pablomartin4btc
2025-06-09 20:19:31 -03:00
parent 573bcd75d7
commit ce90f0c99f
2 changed files with 0 additions and 18 deletions

View File

@@ -356,11 +356,6 @@ RPCHelpMan importdescriptors()
// the user could have gotten from another RPC command prior to now
wallet.BlockUntilSyncedToCurrentChain();
// Make sure wallet is a descriptor wallet
if (!pwallet->IsWalletFlagSet(WALLET_FLAG_DESCRIPTORS)) {
throw JSONRPCError(RPC_WALLET_ERROR, "importdescriptors is not available for non-descriptor wallets");
}
WalletRescanReserver reserver(*pwallet);
if (!reserver.reserve(/*with_passphrase=*/true)) {
throw JSONRPCError(RPC_WALLET_ERROR, "Wallet is currently rescanning. Abort existing rescan or wait.");
@@ -493,10 +488,6 @@ RPCHelpMan listdescriptors()
const std::shared_ptr<const CWallet> wallet = GetWalletForJSONRPCRequest(request);
if (!wallet) return UniValue::VNULL;
if (!wallet->IsWalletFlagSet(WALLET_FLAG_DESCRIPTORS)) {
throw JSONRPCError(RPC_WALLET_ERROR, "listdescriptors is not available for non-descriptor wallets");
}
const bool priv = !request.params[0].isNull() && request.params[0].get_bool();
if (priv) {
EnsureWalletIsUnlocked(*wallet);

View File

@@ -763,10 +763,6 @@ RPCHelpMan gethdkeys()
const std::shared_ptr<const CWallet> wallet = GetWalletForJSONRPCRequest(request);
if (!wallet) return UniValue::VNULL;
if (!wallet->IsWalletFlagSet(WALLET_FLAG_DESCRIPTORS)) {
throw JSONRPCError(RPC_WALLET_ERROR, "gethdkeys is not available for non-descriptor wallets");
}
LOCK(wallet->cs_wallet);
UniValue options{request.params[0].isNull() ? UniValue::VOBJ : request.params[0]};
@@ -865,11 +861,6 @@ static RPCHelpMan createwalletdescriptor()
std::shared_ptr<CWallet> const pwallet = GetWalletForJSONRPCRequest(request);
if (!pwallet) return UniValue::VNULL;
// Make sure wallet is a descriptor wallet
if (!pwallet->IsWalletFlagSet(WALLET_FLAG_DESCRIPTORS)) {
throw JSONRPCError(RPC_WALLET_ERROR, "createwalletdescriptor is not available for non-descriptor wallets");
}
std::optional<OutputType> output_type = ParseOutputType(request.params[0].get_str());
if (!output_type) {
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, strprintf("Unknown address type '%s'", request.params[0].get_str()));