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

Improve startup resource usage #2733

Merged
merged 5 commits into from Sep 26, 2023
Merged

Conversation

t-bast
Copy link
Member

@t-bast t-bast commented Aug 29, 2023

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 our cltv_expiry_delta is 144 blocks and our to_self_delay is 720 blocks.

@t-bast t-bast requested review from pm47 and sstone August 29, 2023 10:19
@t-bast t-bast force-pushed the improve-startup-resource-usage branch from 00a16b3 to 0eb0524 Compare August 29, 2023 12:00
@codecov-commenter
Copy link

codecov-commenter commented Aug 29, 2023

Codecov Report

Merging #2733 (763720f) into master (6f87137) will increase coverage by 0.03%.
Report is 7 commits behind head on master.
The diff coverage is 94.54%.

❗ 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     
Files Coverage Δ
...re/src/main/scala/fr/acinq/eclair/NodeParams.scala 93.33% <100.00%> (+0.04%) ⬆️
...in/scala/fr/acinq/eclair/channel/fsm/Channel.scala 85.52% <100.00%> (+0.24%) ⬆️
...inq/eclair/channel/fsm/ChannelOpenDualFunded.scala 86.96% <100.00%> (ø)
...q/eclair/channel/fsm/ChannelOpenSingleFunded.scala 93.46% <100.00%> (ø)
...la/fr/acinq/eclair/channel/fsm/ErrorHandlers.scala 83.44% <100.00%> (+0.11%) ⬆️
...inq/eclair/channel/fsm/SingleFundingHandlers.scala 66.66% <100.00%> (ø)
...cinq/eclair/channel/publish/MempoolTxMonitor.scala 87.95% <100.00%> (ø)
...q/eclair/channel/publish/ReplaceableTxFunder.scala 84.97% <100.00%> (-0.52%) ⬇️
...main/scala/fr/acinq/eclair/io/PeerConnection.scala 86.23% <100.00%> (-0.73%) ⬇️
...in/scala/fr/acinq/eclair/io/ReconnectionTask.scala 98.07% <100.00%> (ø)
... and 7 more

... and 14 files with indirect coverage changes

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.
@t-bast t-bast force-pushed the improve-startup-resource-usage branch from 0eb0524 to 3800e6c Compare September 21, 2023 14:52
Copy link
Member

@pm47 pm47 left a 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.

Copy link
Member

@sstone sstone left a 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

@t-bast t-bast merged commit e3ba524 into master Sep 26, 2023
1 check passed
@t-bast t-bast deleted the improve-startup-resource-usage branch September 26, 2023 14:31
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.

None yet

4 participants