-
Notifications
You must be signed in to change notification settings - Fork 414
Log peer's features if they require some unknown features we don't support #2947
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
Log peer's features if they require some unknown features we don't support #2947
Conversation
Codecov ReportAttention: Patch coverage is
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## main #2947 +/- ##
==========================================
+ Coverage 89.40% 89.41% +0.01%
==========================================
Files 117 117
Lines 96016 96217 +201
Branches 96016 96217 +201
==========================================
+ Hits 85842 86033 +191
- Misses 7957 7964 +7
- Partials 2217 2220 +3 ☔ View full report in Codecov by Sentry. |
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.
IIRC the to-string for a feature doesn't actually say which features are set which are unknown, only that there are some unknown features. In this case it seems like we should probably include what those features are.
a832dd1
to
1176ba2
Compare
Done, we now log which features are unknown to us (in BOLT09 bit number format). Also rebased to make CI pass. |
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.
I think the first commit can now just get the rest of them squashed.
5198054
to
c472b30
Compare
LGTM, feel free to squash the fixups. |
c472b30
to
5e80316
Compare
Squashed fixups without further changes. |
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 optout's comment on duplicate resolved or as a follow-up)
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.
I'm pretty sure the first commit should be squashed-into, its entirely changed by the second commit.
5e80316
to
0db201c
Compare
Ah, true, squashed it in and rebased to make CI happy. However now created a new fixup to address your last comment. |
LGTM, feel free to squash. |
0db201c
to
9ee73df
Compare
Squashed without further changes. |
.. which allows to DRY up their usage in several places.
9ee73df
to
44cf692
Compare
Force-pushed the following fixups: > git diff-tree -U2 9ee73dfb3 44cf6928d
diff --git a/lightning/src/ln/features.rs b/lightning/src/ln/features.rs
index 9a0c2b30e..8de57c2b9 100644
--- a/lightning/src/ln/features.rs
+++ b/lightning/src/ln/features.rs
@@ -788,5 +788,5 @@ impl<T: sealed::Context> Features<T> {
if byte & unknown_features != 0 {
for bit in (0..8).step_by(2) {
- if byte >> bit & 1 == 1 {
+ if ((byte & unknown_features) >> bit) & 1 == 1 {
unknown_bits.push(i * 8 + bit);
}
@@ -1067,9 +1067,13 @@ mod tests {
let mut features = ChannelFeatures::empty();
- features.set_unknown_feature_optional();
+ features.set_unknown_feature_required();
features.set_custom_bit(123456786).unwrap();
assert!(features.requires_unknown_bits());
assert!(features.supports_unknown_bits());
- assert_eq!(features.required_unknown_bits_from(&ChannelFeatures::empty()), vec![123456786]);
+ assert_eq!(features.required_unknown_bits_from(&ChannelFeatures::empty()), vec![123456786, 123456788]);
+
+ let mut limiter = ChannelFeatures::empty();
+ limiter.set_unknown_feature_optional();
+ assert_eq!(features.required_unknown_bits_from(&limiter), vec![123456786]);
} |
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.
Your turn @dunxen
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.
Very sorry for the delay here @tnull. Completely fell off my radar.
Thankfully no conflicts? LGTM now.
Previously, when a peer sends us features we don't understand we wouldn't log them, but just log
Peer requires features unknown to us
.Here, we fix this.