Skip to content

Commit 21e9a9c

Browse files
authored
Merge pull request #4156 from wpaulino/splice-prototype-feature-bit
Signal splice prototype feature bit instead
2 parents da1c25d + bddd5c7 commit 21e9a9c

File tree

2 files changed

+38
-17
lines changed

2 files changed

+38
-17
lines changed

lightning-types/src/features.rs

Lines changed: 35 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -166,15 +166,15 @@ mod sealed {
166166
// Byte 6
167167
ZeroConf,
168168
// Byte 7
169-
Trampoline | SimpleClose | Splice,
169+
Trampoline | SimpleClose | SpliceProduction,
170170
// Byte 8 - 16
171171
,,,,,,,,,
172172
// Byte 17
173173
AnchorZeroFeeCommitmentsStaging,
174174
// Byte 18
175175
,
176176
// Byte 19
177-
HtlcHold,
177+
HtlcHold | SplicePrototype,
178178
]
179179
);
180180
define_context!(
@@ -195,15 +195,15 @@ mod sealed {
195195
// Byte 6
196196
ZeroConf | Keysend,
197197
// Byte 7
198-
Trampoline | SimpleClose | Splice,
198+
Trampoline | SimpleClose | SpliceProduction,
199199
// Byte 8 - 16
200200
,,,,,,,,,
201201
// Byte 17
202202
AnchorZeroFeeCommitmentsStaging,
203203
// Byte 18
204204
,
205205
// Byte 19
206-
HtlcHold,
206+
HtlcHold | SplicePrototype,
207207
// Byte 20 - 31
208208
,,,,,,,,,,,,
209209
// Byte 32
@@ -687,14 +687,14 @@ mod sealed {
687687
);
688688
define_feature!(
689689
63,
690-
Splice,
690+
SpliceProduction,
691691
[InitContext, NodeContext],
692692
"Feature flags for channel splicing.",
693-
set_splicing_optional,
694-
set_splicing_required,
695-
clear_splicing,
696-
supports_splicing,
697-
requires_splicing
693+
set_splicing_production_optional,
694+
set_splicing_production_required,
695+
clear_splicing_production,
696+
supports_splicing_production,
697+
requires_splicing_production
698698
);
699699
// By default, allocate enough bytes to cover up to Splice. Update this as new features are
700700
// added which we expect to appear commonly across contexts.
@@ -721,6 +721,17 @@ mod sealed {
721721
supports_htlc_hold,
722722
requires_htlc_hold
723723
);
724+
define_feature!(
725+
155, // Splice prototype feature bit as listed in https://github.com/lightning/bolts/issues/605#issuecomment-877237519.
726+
SplicePrototype,
727+
[InitContext, NodeContext],
728+
"Feature flags for channel splicing.",
729+
set_splicing_optional,
730+
set_splicing_required,
731+
clear_splicing,
732+
supports_splicing,
733+
requires_splicing
734+
);
724735
define_feature!(
725736
259,
726737
DnsResolver,
@@ -1431,15 +1442,27 @@ mod tests {
14311442
// - option_channel_type | option_scid_alias
14321443
// - option_zeroconf
14331444
// - option_simple_close | option_splice
1434-
assert_eq!(node_features.flags.len(), 8);
1445+
assert_eq!(node_features.flags.len(), 20);
14351446
assert_eq!(node_features.flags[0], 0b00000001);
14361447
assert_eq!(node_features.flags[1], 0b01010001);
14371448
assert_eq!(node_features.flags[2], 0b10001010);
14381449
assert_eq!(node_features.flags[3], 0b00001010);
14391450
assert_eq!(node_features.flags[4], 0b10001000);
14401451
assert_eq!(node_features.flags[5], 0b10100000);
14411452
assert_eq!(node_features.flags[6], 0b00001000);
1442-
assert_eq!(node_features.flags[7], 0b10100000);
1453+
assert_eq!(node_features.flags[7], 0b00100000);
1454+
assert_eq!(node_features.flags[8], 0b00000000);
1455+
assert_eq!(node_features.flags[9], 0b00000000);
1456+
assert_eq!(node_features.flags[10], 0b00000000);
1457+
assert_eq!(node_features.flags[11], 0b00000000);
1458+
assert_eq!(node_features.flags[12], 0b00000000);
1459+
assert_eq!(node_features.flags[13], 0b00000000);
1460+
assert_eq!(node_features.flags[14], 0b00000000);
1461+
assert_eq!(node_features.flags[15], 0b00000000);
1462+
assert_eq!(node_features.flags[16], 0b00000000);
1463+
assert_eq!(node_features.flags[17], 0b00000000);
1464+
assert_eq!(node_features.flags[18], 0b00000000);
1465+
assert_eq!(node_features.flags[19], 0b00001000);
14431466
}
14441467

14451468
// Check that cleared flags are kept blank when converting back:

lightning/src/ln/msgs.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2983,8 +2983,7 @@ impl_writeable_msg!(CommitmentSigned, {
29832983
signature,
29842984
htlc_signatures
29852985
}, {
2986-
// TOOD(splicing): Change this to 1 once the spec is finalized
2987-
(1001, funding_txid, option),
2986+
(1, funding_txid, option),
29882987
});
29892988

29902989
#[cfg(taproot)]
@@ -2993,9 +2992,8 @@ impl_writeable_msg!(CommitmentSigned, {
29932992
signature,
29942993
htlc_signatures
29952994
}, {
2995+
(1, funding_txid, option),
29962996
(2, partial_signature_with_nonce, option),
2997-
// TOOD(splicing): Change this to 1 and reorder once the spec is finalized
2998-
(1001, funding_txid, option),
29992997
});
30002998

30012999
impl_writeable!(DecodedOnionErrorPacket, {
@@ -5959,7 +5957,7 @@ mod tests {
59595957
} else {
59605958
target_value += "0000";
59615959
}
5962-
target_value += "fd03e9"; // Type (funding_txid)
5960+
target_value += "01"; // Type (funding_txid)
59635961
target_value += "20"; // Length (funding_txid)
59645962
target_value += "6e96fe9f8b0ddcd729ba03cfafa5a27b050b39d354dd980814268dfa9a44d4c2"; // Value
59655963
assert_eq!(encoded_value.as_hex().to_string(), target_value);

0 commit comments

Comments
 (0)