Conversation
We compute channel keys when we load and verify channels from our database, and pass them along instead of re-computing them later (which is expensive).
|
Is this really worth the additional complexity? This is 100% CPU-bound, so it's not a very expensive code-path on restart (the restart issues are rather IO-bound or memory-related, we never have a CPU bottleneck, even on restart). Maybe I'm turned off by the |
There's also a consistency issue: we create channel keys and use them to validate the channel seed, and discard them immediately
Yes it's not very nice so far attempts to avoid such a message created even more complexity, I'll try and find something better. |
|
I went for a simpler approach in 7b17a4f where channel keys are stored as a transient, optional property of |
We currently compute channel keys when we load channels from our database and discard them, so we'll compute them a second time (and potentially a 3rd time for some of them when we "clean" HTLCs).
Here we keep the keys generated when channels were loaded and pass them along as needed.
This can reduce startup time on nodes with many channels (on a local test on a dev machine with a node with 10 000 channels startup time went from 19s down to 12s).