mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-03-15 20:09:18 +01:00
wallet: perform wallet_can_spend exit logic only once
Signed-off-by: Jon Griffiths <jon_p_griffiths@yahoo.com>
This commit is contained in:
parent
156a16e7e6
commit
fbd8e8b571
1 changed files with 9 additions and 15 deletions
|
@ -828,28 +828,22 @@ bool wallet_can_spend(struct wallet *w, const u8 *script,
|
|||
tal_free(s);
|
||||
s = p2sh;
|
||||
}
|
||||
if (scripteq(s, script)) {
|
||||
if (!scripteq(s, script)) {
|
||||
/* Try taproot output now */
|
||||
tal_free(s);
|
||||
s = scriptpubkey_p2tr_derkey(w, ext.pub_key);
|
||||
if (!scripteq(s, script))
|
||||
s = tal_free(s);
|
||||
}
|
||||
tal_free(s);
|
||||
if (s) {
|
||||
/* If we found a used key in the keyscan_gap we should
|
||||
* remember that. */
|
||||
if (i > bip32_max_index)
|
||||
db_set_intvar(w->db, "bip32_max_index", i);
|
||||
tal_free(s);
|
||||
*index = i;
|
||||
return true;
|
||||
}
|
||||
tal_free(s);
|
||||
/* Try taproot output now */
|
||||
s = scriptpubkey_p2tr_derkey(w, ext.pub_key);
|
||||
if (scripteq(s, script)) {
|
||||
/* If we found a used key in the keyscan_gap we should
|
||||
* remember that. */
|
||||
if (i > bip32_max_index)
|
||||
db_set_intvar(w->db, "bip32_max_index", i);
|
||||
tal_free(s);
|
||||
*index = i;
|
||||
return true;
|
||||
}
|
||||
tal_free(s);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue