-
Notifications
You must be signed in to change notification settings - Fork 265
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
Improve startup resource usage #2733
Conversation
00a16b3
to
0eb0524
Compare
Codecov Report
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. @@ Coverage Diff @@
## master #2733 +/- ##
==========================================
+ Coverage 85.78% 85.82% +0.03%
==========================================
Files 216 216
Lines 18013 18061 +48
Branches 759 743 -16
==========================================
+ Hits 15453 15500 +47
- Misses 2560 2561 +1
|
This should reduce the pressure on the file system and RAM without impacting our ability to troubleshoot common issues.
When we restart, we put watches on every public channel in the network. That creates a lot of RPC calls to bitcoind, which aren't time-sensitive. It's ok if we don't see immediately that an external channel was closed, the spec even recommends waiting for 12 blocks to distinguish a channel close from a splice. By default, we now smooth that over a 1 hour period. This means we should also allow our peers to be late at discovering that a channel was closed. We thus stop sending a `warning` in that case and increase our tolerance to that kind of behavior.
When we restart, we set watches on our funding transactions. But we don't actually need to watch them immediately, we just need enough time to react to our peer broadcasting their commitment. We use long `cltv_delta` delays to guarantee funds safety, so we can spread out the watches across several blocks to reduce the start-up load. It essentially is the same thing as receiving mempool transactions or blocks after a delay, which is something that our threat model already takes into account.
0eb0524
to
3800e6c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, just a few nits.
eclair-core/src/main/scala/fr/acinq/eclair/channel/fsm/CommonFundingHandlers.scala
Show resolved
Hide resolved
eclair-core/src/main/scala/fr/acinq/eclair/channel/fsm/CommonFundingHandlers.scala
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, just a nit
This PR contains independent commits to reduce the load and performance hit on node restart.
@pm47 the ACINQ node should set a higher value than the default for
eclair.channel.max-restart-watch-delay
, since this depends on the number of channels the node has. I think this value can safely go up to 30 minutes (3 blocks) since ourcltv_expiry_delta
is144
blocks and ourto_self_delay
is720
blocks.