mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-13 12:33:42 +02:00
Merge ElementsProject/elements#1066: Reevaluate descriptor post parse
6c1d0d3ca8 Re-evaluate peg-out descriptor if wallet is reparsed (Jeff Frontz)
Pull request description:
In `sendtomainchain_pak()` a check is made if the associated `descriptor` is null and an attempt to remedy is made -- but the remedy is never applied to `descriptor` (which results in a SEGV later). This code fixes that.
Note: unfortunately it also removes the `const` qualifier. I'm not sure what/if there are conventions for dealing with that (e.g., creating a new `const` of, like, `sanitized_descriptor` for subsequent use in the function?).
Top commit has no ACKs.
Tree-SHA512: 8fb4a28ebd0d76647c1b0ecf98f3e18905c880a9562caa1b02ca66647dcbe00b2a6bd91da7ce6a61bd34bb3096030714417170badccdaeaa4c0a03e8704f8ca1
This commit is contained in:
commit
3c4e4ada12
1 changed files with 6 additions and 1 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue