Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wallet can spend takes ages #8019

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

rustyrussell
Copy link
Contributor

Fixes: #8014

…sses.

From Whitslack's "startup takes 15 minutes" bug report, we can see
that wallet_can_spend is extremely slow.  We exacerbate this by setting a large
bip32_max_index:

```
    91.29%     0.02%  lightningd       lightningd                 [.] wallet_can_spend
            |          
             --91.27%--wallet_can_spend
                       |          
                       |--47.81%--scriptpubkey_p2tr_derkey
                       |          |          
                       |          |--42.80%--scriptpubkey_p2tr
...
                       |--42.16%--bip32_key_from_parent
```

Signed-off-by: Rusty Russell <[email protected]>
It was long obsoleted, and never appears in the DB, but we do still have
to handle old ones in the code.

We removed it from the enum in
f342630 (v24.02) after deprecating it
in 23.02.

Signed-off-by: Rusty Russell <[email protected]>
Turns out we don't actually use this, so easy to change the function.

Signed-off-by: Rusty Russell <[email protected]>
For now we don't actually update it; that's next patch.

Signed-off-by: Rusty Russell <[email protected]>
@rustyrussell rustyrussell added this to the v25.02 milestone Jan 20, 2025
On lookup, we update the htable if any new addresses have been added.

Signed-off-by: Rusty Russell <[email protected]>
Changelog-Fixed: lightningd: startup time vastly improved for large nodes with pending closes and many bitcoin addresses.
@rustyrussell rustyrussell force-pushed the guilt/wallet-can-spend-takes-ages branch from 1e0f9cd to 99ecd13 Compare January 22, 2025 01:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Startup on large nodes is slow
1 participant