Skip to content

Conversation

@rustyrussell
Copy link
Contributor

Fixes: #8014

@rustyrussell rustyrussell added this to the v25.02 milestone Jan 20, 2025
@rustyrussell rustyrussell force-pushed the guilt/wallet-can-spend-takes-ages branch from 1e0f9cd to 99ecd13 Compare January 22, 2025 01:55
@rustyrussell rustyrussell force-pushed the guilt/wallet-can-spend-takes-ages branch from 0689086 to a8f1b8a Compare February 12, 2025 00:53
…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]>
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 a8f1b8a to 481a247 Compare February 13, 2025 02:39
As I suspected, benchmark tests like this are too unreliable under CI.

Signed-off-by: Rusty Russell <[email protected]>
@endothermicdev endothermicdev force-pushed the guilt/wallet-can-spend-takes-ages branch from cec8d01 to f1c2ef3 Compare February 13, 2025 15:16
@endothermicdev
Copy link
Collaborator

That's a shame about removing the test, it seems like it ran fine 90% of the time, but apparently there's a long tail in the distribution of outcomes under CI.

Copy link
Collaborator

@endothermicdev endothermicdev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK f1c2ef3

@endothermicdev endothermicdev merged commit df24568 into ElementsProject:master Feb 13, 2025
39 of 40 checks passed
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

2 participants