Skip to content

Commit 6d3b752

Browse files
committed
Set payment_secret to required in features flags
1 parent 4f6a038 commit 6d3b752

File tree

1 file changed

+17
-10
lines changed

1 file changed

+17
-10
lines changed

lightning/src/ln/features.rs

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ mod sealed {
9292
// Byte 0
9393
,
9494
// Byte 1
95-
StaticRemoteKey,
95+
StaticRemoteKey | PaymentSecret,
9696
// Byte 2
9797
,
9898
// Byte 3
@@ -102,7 +102,7 @@ mod sealed {
102102
// Byte 0
103103
DataLossProtect | InitialRoutingSync | UpfrontShutdownScript | GossipQueries,
104104
// Byte 1
105-
VariableLengthOnion | PaymentSecret,
105+
VariableLengthOnion,
106106
// Byte 2
107107
BasicMPP,
108108
// Byte 3
@@ -114,7 +114,7 @@ mod sealed {
114114
// Byte 0
115115
,
116116
// Byte 1
117-
StaticRemoteKey,
117+
StaticRemoteKey | PaymentSecret,
118118
// Byte 2
119119
,
120120
// Byte 3
@@ -124,7 +124,7 @@ mod sealed {
124124
// Byte 0
125125
DataLossProtect | UpfrontShutdownScript | GossipQueries,
126126
// Byte 1
127-
VariableLengthOnion | PaymentSecret,
127+
VariableLengthOnion,
128128
// Byte 2
129129
BasicMPP,
130130
// Byte 3
@@ -136,12 +136,19 @@ mod sealed {
136136
optional_features: [],
137137
});
138138
define_context!(InvoiceContext {
139-
required_features: [,,,],
139+
required_features: [
140+
// Byte 0
141+
,
142+
// Byte 1
143+
PaymentSecret,
144+
// Byte 2
145+
,
146+
],
140147
optional_features: [
141148
// Byte 0
142149
,
143150
// Byte 1
144-
VariableLengthOnion | PaymentSecret,
151+
VariableLengthOnion,
145152
// Byte 2
146153
BasicMPP,
147154
],
@@ -665,8 +672,8 @@ mod tests {
665672

666673
assert!(InitFeatures::known().supports_payment_secret());
667674
assert!(NodeFeatures::known().supports_payment_secret());
668-
assert!(!InitFeatures::known().requires_payment_secret());
669-
assert!(!NodeFeatures::known().requires_payment_secret());
675+
assert!(InitFeatures::known().requires_payment_secret());
676+
assert!(NodeFeatures::known().requires_payment_secret());
670677

671678
assert!(InitFeatures::known().supports_basic_mpp());
672679
assert!(NodeFeatures::known().supports_basic_mpp());
@@ -712,12 +719,12 @@ mod tests {
712719
{
713720
// Check that the flags are as expected:
714721
// - option_data_loss_protect
715-
// - var_onion_optin | static_remote_key (req) | payment_secret
722+
// - var_onion_optin | static_remote_key (req) | payment_secret(req)
716723
// - basic_mpp
717724
// - opt_shutdown_anysegwit
718725
assert_eq!(node_features.flags.len(), 4);
719726
assert_eq!(node_features.flags[0], 0b00000010);
720-
assert_eq!(node_features.flags[1], 0b10010010);
727+
assert_eq!(node_features.flags[1], 0b01010010);
721728
assert_eq!(node_features.flags[2], 0b00000010);
722729
assert_eq!(node_features.flags[3], 0b00001000);
723730
}

0 commit comments

Comments
 (0)