Skip to content

Commit

Permalink
wallet: avoid database lookups for non-interesting script types
Browse files Browse the repository at this point in the history
Signed-off-by: Jon Griffiths <jon_p_griffiths@yahoo.com>
  • Loading branch information
jgriffiths authored and rustyrussell committed Mar 18, 2024
1 parent aa23c2a commit 4055393
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion wallet/wallet.c
Original file line number Diff line number Diff line change
Expand Up @@ -798,7 +798,7 @@ bool wallet_can_spend(struct wallet *w, const u8 *script,
u32 *index, bool *output_is_p2sh)
{
struct ext_key ext;
u64 bip32_max_index = db_get_intvar(w->db, "bip32_max_index", 0);
u64 bip32_max_index;
size_t script_len = tal_bytelen(script);
u32 i;

Expand All @@ -812,6 +812,7 @@ bool wallet_can_spend(struct wallet *w, const u8 *script,
else
return false;

bip32_max_index = db_get_intvar(w->db, "bip32_max_index", 0);
for (i = 0; i <= bip32_max_index + w->keyscan_gap; i++) {
u8 *s;

Expand Down

0 comments on commit 4055393

Please sign in to comment.