Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 35 additions & 12 deletions lightning-types/src/features.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,15 +166,15 @@ mod sealed {
// Byte 6
ZeroConf,
// Byte 7
Trampoline | SimpleClose | Splice,
Trampoline | SimpleClose | SpliceProduction,
// Byte 8 - 16
,,,,,,,,,
// Byte 17
AnchorZeroFeeCommitmentsStaging,
// Byte 18
,
// Byte 19
HtlcHold,
HtlcHold | SplicePrototype,
]
);
define_context!(
Expand All @@ -195,15 +195,15 @@ mod sealed {
// Byte 6
ZeroConf | Keysend,
// Byte 7
Trampoline | SimpleClose | Splice,
Trampoline | SimpleClose | SpliceProduction,
// Byte 8 - 16
,,,,,,,,,
// Byte 17
AnchorZeroFeeCommitmentsStaging,
// Byte 18
,
// Byte 19
HtlcHold,
HtlcHold | SplicePrototype,
// Byte 20 - 31
,,,,,,,,,,,,
// Byte 32
Expand Down Expand Up @@ -687,14 +687,14 @@ mod sealed {
);
define_feature!(
63,
Splice,
SpliceProduction,
[InitContext, NodeContext],
"Feature flags for channel splicing.",
set_splicing_optional,
set_splicing_required,
clear_splicing,
supports_splicing,
requires_splicing
set_splicing_production_optional,
set_splicing_production_required,
clear_splicing_production,
supports_splicing_production,
requires_splicing_production
);
// By default, allocate enough bytes to cover up to Splice. Update this as new features are
// added which we expect to appear commonly across contexts.
Expand All @@ -721,6 +721,17 @@ mod sealed {
supports_htlc_hold,
requires_htlc_hold
);
define_feature!(
155, // Splice prototype feature bit as listed in https://github.com/lightning/bolts/issues/605#issuecomment-877237519.
SplicePrototype,
[InitContext, NodeContext],
"Feature flags for channel splicing.",
set_splicing_optional,
set_splicing_required,
clear_splicing,
supports_splicing,
requires_splicing
);
define_feature!(
259,
DnsResolver,
Expand Down Expand Up @@ -1431,15 +1442,27 @@ mod tests {
// - option_channel_type | option_scid_alias
// - option_zeroconf
// - option_simple_close | option_splice
assert_eq!(node_features.flags.len(), 8);
assert_eq!(node_features.flags.len(), 20);
assert_eq!(node_features.flags[0], 0b00000001);
assert_eq!(node_features.flags[1], 0b01010001);
assert_eq!(node_features.flags[2], 0b10001010);
assert_eq!(node_features.flags[3], 0b00001010);
assert_eq!(node_features.flags[4], 0b10001000);
assert_eq!(node_features.flags[5], 0b10100000);
assert_eq!(node_features.flags[6], 0b00001000);
assert_eq!(node_features.flags[7], 0b10100000);
assert_eq!(node_features.flags[7], 0b00100000);
assert_eq!(node_features.flags[8], 0b00000000);
assert_eq!(node_features.flags[9], 0b00000000);
assert_eq!(node_features.flags[10], 0b00000000);
assert_eq!(node_features.flags[11], 0b00000000);
assert_eq!(node_features.flags[12], 0b00000000);
assert_eq!(node_features.flags[13], 0b00000000);
assert_eq!(node_features.flags[14], 0b00000000);
assert_eq!(node_features.flags[15], 0b00000000);
assert_eq!(node_features.flags[16], 0b00000000);
assert_eq!(node_features.flags[17], 0b00000000);
assert_eq!(node_features.flags[18], 0b00000000);
assert_eq!(node_features.flags[19], 0b00001000);
}

// Check that cleared flags are kept blank when converting back:
Expand Down
8 changes: 3 additions & 5 deletions lightning/src/ln/msgs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2983,8 +2983,7 @@ impl_writeable_msg!(CommitmentSigned, {
signature,
htlc_signatures
}, {
// TOOD(splicing): Change this to 1 once the spec is finalized
(1001, funding_txid, option),
(1, funding_txid, option),
});

#[cfg(taproot)]
Expand All @@ -2993,9 +2992,8 @@ impl_writeable_msg!(CommitmentSigned, {
signature,
htlc_signatures
}, {
(1, funding_txid, option),
(2, partial_signature_with_nonce, option),
// TOOD(splicing): Change this to 1 and reorder once the spec is finalized
(1001, funding_txid, option),
});

impl_writeable!(DecodedOnionErrorPacket, {
Expand Down Expand Up @@ -5959,7 +5957,7 @@ mod tests {
} else {
target_value += "0000";
}
target_value += "fd03e9"; // Type (funding_txid)
target_value += "01"; // Type (funding_txid)
target_value += "20"; // Length (funding_txid)
target_value += "6e96fe9f8b0ddcd729ba03cfafa5a27b050b39d354dd980814268dfa9a44d4c2"; // Value
assert_eq!(encoded_value.as_hex().to_string(), target_value);
Expand Down