diff --git a/lightning-types/src/features.rs b/lightning-types/src/features.rs index 835c8d2e687..54f1d9e44f0 100644 --- a/lightning-types/src/features.rs +++ b/lightning-types/src/features.rs @@ -166,7 +166,7 @@ mod sealed { // Byte 6 ZeroConf, // Byte 7 - Trampoline | SimpleClose | Splice, + Trampoline | SimpleClose | SpliceProduction, // Byte 8 - 16 ,,,,,,,,, // Byte 17 @@ -174,7 +174,7 @@ mod sealed { // Byte 18 , // Byte 19 - HtlcHold, + HtlcHold | SplicePrototype, ] ); define_context!( @@ -195,7 +195,7 @@ mod sealed { // Byte 6 ZeroConf | Keysend, // Byte 7 - Trampoline | SimpleClose | Splice, + Trampoline | SimpleClose | SpliceProduction, // Byte 8 - 16 ,,,,,,,,, // Byte 17 @@ -203,7 +203,7 @@ mod sealed { // Byte 18 , // Byte 19 - HtlcHold, + HtlcHold | SplicePrototype, // Byte 20 - 31 ,,,,,,,,,,,, // Byte 32 @@ -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. @@ -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, @@ -1431,7 +1442,7 @@ 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); @@ -1439,7 +1450,19 @@ mod tests { 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: diff --git a/lightning/src/ln/msgs.rs b/lightning/src/ln/msgs.rs index fd806a27951..354273f7170 100644 --- a/lightning/src/ln/msgs.rs +++ b/lightning/src/ln/msgs.rs @@ -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)] @@ -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, { @@ -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);