-
Notifications
You must be signed in to change notification settings - Fork 436
Set dont_forward on private channel updates and add tests #4340
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
Set dont_forward on private channel updates and add tests #4340
Conversation
|
👋 I see @wpaulino was un-assigned. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4340 +/- ##
==========================================
- Coverage 86.53% 86.00% -0.54%
==========================================
Files 158 156 -2
Lines 103190 102652 -538
Branches 103190 102652 -538
==========================================
- Hits 89300 88285 -1015
- Misses 11469 11857 +388
- Partials 2421 2510 +89
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
🔔 1st Reminder Hey @wpaulino! This PR has been waiting for your review. |
|
We should also ignore updates we receive with the bit set in our network graph/p2pgossipmessagehandler. |
TheBlueMatt
left a comment
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.
Thanks!
| // message_flags should be 1 (only must_be_one bit set, dont_forward NOT set) | ||
| assert_eq!( | ||
| public_channel_update.contents.message_flags & (1 << 1), | ||
| 0, | ||
| "Public channel update should NOT have dont_forward bit set" |
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.
There's really no need to include both a comment and assertion text that say the same thing. In general code should be self-explanatory and excess comments and assertion text is just distracting. LLMs love to be super duper verbose which often only serves to obscure what's going on.
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.
Thanks for the review and merging! I'll be more mindful about avoiding redundant comments and assertion text going forward. I'll also be more careful with my use of tools.
Fixes #1672.
Changes:
dont_forwardbit (message_flags bit 1) onchannel_updatemessages for private channelschannel_updategossip messages that havedont_forwardset inP2PGossipSyncchannel_updatewithdont_forwardset for an unknown channel, suggesting the user check thetx_indexpassed tochain::Confirm::transactions_confirmedDetails
Outbound flag setting:
ChannelManager::get_channel_update_for_unicast, we now set:message_flags = 1 | (1 << 1)for private channels (must_be_one+dont_forward)message_flags = 1for public channels (must_be_oneonly)Inbound filtering:
P2PGossipSync::handle_channel_update, channel updates with thedont_forwardbit set are rejected withErrorAction::IgnoreAndLog(Level::Debug)to prevent them from polluting the network graphDiagnostic logging:
internal_channel_update, if we receive achannel_updatefor an unknown SCID withdont_forwardset, we log a debug message suggesting the user verify thetx_indexpassed tochain::Confirm::transactions_confirmedTests
handling_channel_update_with_dont_forward_flag- verifies gossip layer rejects updates withdont_forwardbittest_channel_update_dont_forward_flag- verifies private channels set the flag, public channels don'ttest_unknown_channel_update_with_dont_forward_logs_debug- verifies debug logging for unknown channel updatesBased on lightning/bolts#999: BOLT 7
dont_forwardflag for SCID aliases.