Skip to content

Commit 6bc1a49

Browse files
committed
f Add comment explaining feature byte computation
1 parent 4426faa commit 6bc1a49

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

lightning/src/ln/features.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,14 @@ mod sealed {
5252

5353
impl Context for $context {
5454
const KNOWN_FEATURE_FLAGS: &'static [u8] = &[
55+
// For each byte, use bitwise-OR to compute the applicable flags for known
56+
// required features `r_i` and optional features `o_j` for all `i` and `j` such
57+
// that the following slice is formed:
58+
//
59+
// [
60+
// `r_0` | `r_1` | ... | `o_0` | `o_1` | ...,
61+
// ...,
62+
// ]
5563
$(
5664
0b00_00_00_00 $(|
5765
<Self as $required_feature>::REQUIRED_MASK)*
@@ -61,6 +69,8 @@ mod sealed {
6169
];
6270

6371
const KNOWN_FEATURE_MASK: &'static [u8] = &[
72+
// Similar as above, but set both flags for each feature regardless of whether
73+
// the feature is required or optional.
6474
$(
6575
0b00_00_00_00 $(|
6676
<Self as $required_feature>::REQUIRED_MASK |

0 commit comments

Comments
 (0)