mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-02-22 06:41:44 +01:00
wallet: avoid computing the key fingerprint while looking for matches
Avoids a hash160 for every key we derive to test. Callers that need the key re-derive it without the skip flag, so there are no side effects from this optimization. Changelog-Changed: core: Processing blocks should now be faster Signed-off-by: Jon Griffiths <jon_p_griffiths@yahoo.com>
This commit is contained in:
parent
f01e9fe160
commit
156a16e7e6
1 changed files with 2 additions and 2 deletions
|
@ -815,11 +815,11 @@ bool wallet_can_spend(struct wallet *w, const u8 *script,
|
|||
|
||||
bip32_max_index = db_get_intvar(w->db, "bip32_max_index", 0);
|
||||
for (i = 0; i <= bip32_max_index + w->keyscan_gap; i++) {
|
||||
const u32 flags = BIP32_FLAG_KEY_PUBLIC | BIP32_FLAG_SKIP_HASH;
|
||||
u8 *s;
|
||||
|
||||
if (bip32_key_from_parent(w->ld->bip32_base, i,
|
||||
BIP32_FLAG_KEY_PUBLIC, &ext)
|
||||
!= WALLY_OK) {
|
||||
flags, &ext) != WALLY_OK) {
|
||||
abort();
|
||||
}
|
||||
s = scriptpubkey_p2wpkh_derkey(w, ext.pub_key);
|
||||
|
|
Loading…
Add table
Reference in a new issue