-
Notifications
You must be signed in to change notification settings - Fork 407
Check chain hash for channel announcement and update #2230
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
Check chain hash for channel announcement and update #2230
Conversation
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 with one small nit.
lightning/src/routing/gossip.rs
Outdated
@@ -2311,6 +2325,15 @@ pub(crate) mod tests { | |||
Ok(_) => panic!(), | |||
Err(e) => assert_eq!(e.err, "Channel announcement node had a channel with itself") | |||
}; | |||
|
|||
// Test that channel announcements with the wrong chain hash are ignored. |
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.
nit: Could we just include why it's the wrong chain hash here? I got a little confused with it in isolation but remembered we were dealing with testnet in these gossip tests.
"testnet vs mainnet" or something similar.
Codecov ReportPatch coverage:
📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more Additional details and impacted files@@ Coverage Diff @@
## main #2230 +/- ##
==========================================
- Coverage 91.56% 91.56% -0.01%
==========================================
Files 104 104
Lines 51749 51767 +18
Branches 51749 51767 +18
==========================================
+ Hits 47384 47398 +14
- Misses 4365 4369 +4
... and 5 files with indirect coverage changes Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report in Codecov by Sentry. |
This could also be done for rapid gossip sync updates |
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 taking this on!
Catching unmatching RGS updates are the primary intention, but I think they are already covered by checking in |
0a43123
to
bd962fc
Compare
Took a look at
Wondering whether we should add a top level check here in RGS so that we can exit early if we have the wrong hash? Would need to add |
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.
Nice!
In a followup, we should also (finally) add support for the init genesis block hash field by fetching the genesis block hash from the ChannelMessageHandler
(ie ChannelManager
) in PeerManager
, then checking that value against what we receive in init message(s) and send it in ours.
Yes, yes we should. |
Fixes #2228