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

Rework channel announcement signatures handling #2969

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

Conversation

t-bast
Copy link
Member

@t-bast t-bast commented Dec 19, 2024

Now that we wait for at least 6 confirmations before considering a channel confirmed, we can simplify our channel announcement logic. Whenever a channel reaches the confirmed state, it can be announced to the network (if nodes wish to announce it). We thus don't need the "deeply buried" state and the "temporary" scid anymore.

The logic is much simpler to follow: when the channel confirms, we internally update the real scid to match the confirmed funding tx and send our announcement_signatures. When we receive our peer's announcement_signatures, we stash them if the funding tx doesn't have enough confirmations yet, otherwise we announce the channel and create a new channel_update that uses the real scid.

Whenever we create a channel_update, we simply look at whether the channel is announced or not to choose which scid to use.

This will make it much simpler to announce splice transactions, which don't need a "deeply buried" state either and will instead simply rely on whether the splice transaction is confirmed or not to generate announcement_signatures.

NB: builds on top of #2973

@t-bast t-bast force-pushed the refactor-funding-deeply-buried branch from 91c5dd1 to 825ca9b Compare December 19, 2024 10:44
@codecov-commenter
Copy link

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 86.03%. Comparing base (5410146) to head (825ca9b).
Report is 18 commits behind head on master.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2969      +/-   ##
==========================================
- Coverage   86.19%   86.03%   -0.16%     
==========================================
  Files         224      227       +3     
  Lines       20074    20334     +260     
  Branches      813      847      +34     
==========================================
+ Hits        17302    17495     +193     
- Misses       2772     2839      +67     
Files with missing lines Coverage Δ
...in/scala/fr/acinq/eclair/channel/Commitments.scala 96.83% <100.00%> (+<0.01%) ⬆️

... and 13 files with indirect coverage changes

@t-bast t-bast force-pushed the refactor-funding-deeply-buried branch from 7817752 to bd49841 Compare December 26, 2024 20:35
@t-bast t-bast changed the title Refactor funding deeply buried and channel announcements Rework channel announcement signatures handling Dec 26, 2024
@t-bast t-bast marked this pull request as ready for review December 26, 2024 20:37
@t-bast t-bast force-pushed the refactor-funding-deeply-buried branch from bd49841 to 8c4f001 Compare December 27, 2024 07:52
@t-bast t-bast requested review from remyers and pm47 December 27, 2024 10:48
Copy link
Contributor

@remyers remyers left a comment

Choose a reason for hiding this comment

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

Looks like a nice simplification for annoucement signatures. I only have a few nits and suggestions so far. I've reviewed it all line by line but will spend some time tomorrow to go back through and review the tests again in more detail to see if I can find anything that might be missing.

Copy link
Contributor

@remyers remyers left a comment

Choose a reason for hiding this comment

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

LGTM!

We already use a minimum depth of 6 before announcing channels to
protect against reorgs. However, we allowed using the channel for
payments after only 3 confirmations (for small channels). A reorg
of 3 blocks that invalidates the funding transaction would allow
our peer to potentially steal funds. It's more consistent to use
the same depth for announcing the channel and actually using it.

Note that for wumbo channels, we already scaled the number of
confirmations based on the size of the channel.

For closing transaction, we don't need the same reorg safety, since
we keep watching the funding output for any transaction that spends
it, and concurrently spend any commitment transaction that we detect.
We thus keep a minimum depth of 3 for closing transactions.
We were still using values from before the halving. We update those
values and change the scaling factor to a reasonable scaling. This
protects channels against attackers with significant mining power.
Now that we wait for at least 6 confirmations before considering a
channel confirmed, we can simplify our channel announcement logic.
Whenever a channel reaches the confirmed state, it can be announced
to the network (if nodes wish to announce it). We thus don't need
the "deeply buried" state and the "temporary" scid anymore.

The logic is much simpler to follow: when the channel confirms, we
internally update the real scid to match the confirmed funding tx
and send our `announcement_signatures`. When we receive our peer's
`announcement_signatures`, we stash them if the funding tx doesn't
have enough confirmations yet, otherwise we announce the channel and
create a new `channel_update` that uses the real scid.

Whenever we create a `channel_update`, we simply look at whether the
channel is announced or not to choose which scid to use.

This will make it much simpler to announce splice transactions, which
don't need a "deeply buried" state either and will instead simply rely
on whether the splice transaction is confirmed or not to generate
`announcement_signatures`.
@t-bast t-bast force-pushed the refactor-funding-deeply-buried branch from 04aa5cf to 5ba0f56 Compare January 10, 2025 15:40
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.

3 participants