diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index b234c37d02..43da2be9fb 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -5656,7 +5656,7 @@ static RPCHelpMan sendtomainchain_pak() FlatSigningProvider provider; std::string error; - const auto descriptor = Parse(pwallet->offline_desc, provider, error); + auto descriptor = Parse(pwallet->offline_desc, provider, error); LegacyScriptPubKeyMan* spk_man = pwallet->GetLegacyScriptPubKeyMan(); if (!spk_man) { @@ -5669,6 +5669,11 @@ static RPCHelpMan sendtomainchain_pak() if (!pwallet->SetOfflineDescriptor(offline_desc)) { throw JSONRPCError(RPC_WALLET_ERROR, "Couldn't set wallet descriptor for peg-outs."); } + + descriptor = Parse(pwallet->offline_desc, provider, error); + if (!descriptor) { + throw JSONRPCError(RPC_WALLET_ERROR, "descriptor still null. This is a bug in elementsd."); + } } std::string desc_str = pwallet->offline_desc;