From 6c1d0d3ca80fe1a9d14f2559d11ba9e89f45fd72 Mon Sep 17 00:00:00 2001 From: Jeff Frontz Date: Thu, 11 Nov 2021 13:39:10 -0500 Subject: [PATCH] Re-evaluate peg-out descriptor if wallet is reparsed --- src/wallet/rpcwallet.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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;