You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: lightning/src/ln/features.rs
+11Lines changed: 11 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -66,6 +66,8 @@
66
66
//! for more info).
67
67
//! - `Keysend` - send funds to a node without an invoice
68
68
//! (see the [`Keysend` feature assignment proposal](https://github.com/lightning/bolts/issues/605#issuecomment-606679798) for more information).
69
+
//! - `Trampoline` - supports receiving and forwarding Trampoline payments
70
+
//! (see the [`Trampoline` feature proposal](https://github.com/lightning/bolts/pull/836) for more information).
69
71
//!
70
72
//! LDK knows about the following features, but does not support them:
71
73
//! - `AnchorsNonzeroFeeHtlcTx` - the initial version of anchor outputs, which was later found to be
@@ -152,6 +154,8 @@ mod sealed {
152
154
ChannelType | SCIDPrivacy,
153
155
// Byte 6
154
156
ZeroConf,
157
+
// Byte 7
158
+
Trampoline,
155
159
]);
156
160
define_context!(NodeContext,[
157
161
// Byte 0
@@ -168,6 +172,8 @@ mod sealed {
168
172
ChannelType | SCIDPrivacy,
169
173
// Byte 6
170
174
ZeroConf | Keysend,
175
+
// Byte 7
176
+
Trampoline,
171
177
]);
172
178
define_context!(ChannelContext,[]);
173
179
define_context!(Bolt11InvoiceContext,[
@@ -185,6 +191,8 @@ mod sealed {
185
191
,
186
192
// Byte 6
187
193
PaymentMetadata,
194
+
// Byte 7
195
+
Trampoline,
188
196
]);
189
197
define_context!(OfferContext,[]);
190
198
define_context!(InvoiceRequestContext,[]);
@@ -420,6 +428,9 @@ mod sealed {
420
428
define_feature!(55,Keysend,[NodeContext],
421
429
"Feature flags for keysend payments.", set_keysend_optional, set_keysend_required,
let public_key = PublicKey::from_slice(&<Vec<u8>>::from_hex("02eec7245d6b7d2ccb30380bfbe2a3648cd7a942653f5aa340edcea1f283686619").unwrap()).unwrap();
4460
+
let hop_data = <Vec<u8>>::from_hex("cff34152f3a36e52ca94e74927203a560392b9cc7ce3c45809c6be52166c24a595716880f95f178bf5b30ca63141f74db6e92795c6130877cfdac3d4bd3087ee73c65d627ddd709112a848cc99e303f3706509aa43ba7c8a88cba175fccf9a8f5016ef06d3b935dbb15196d7ce16dc1a7157845566901d7b2197e52cab4ce487014b14816e5805f9fcacb4f8f88b8ff176f1b94f6ce6b00bc43221130c17d20ef629db7c5f7eafaa166578c720619561dd14b3277db557ec7dcdb793771aef0f2f667cfdbeae3ac8d331c5994779dffb31e5fc0dbdedc0c592ca6d21c18e47fe3528d6975c19517d7e2ea8c5391cf17d0fe30c80913ed887234ccb48808f7ef9425bcd815c3b586210979e3bb286ef2851bf9ce04e28c40a203df98fd648d2f1936fd2f1def0e77eecb277229b4b682322371c0a1dbfcd723a991993df8cc1f2696b84b055b40a1792a29f710295a18fbd351b0f3ff34cd13941131b8278ba79303c89117120eea691738a9954908195143b039dbeed98f26a92585f3d15cf742c953799d3272e0545e9b744be9d3b4c").unwrap();
4461
+
let hmac_vector = <Vec<u8>>::from_hex("bb079bfc4b35190eee9f59a1d7b41ba2f773179f322dafb4b1af900c289ebd6c").unwrap();
4462
+
letmut hmac = [0;32];
4463
+
hmac.copy_from_slice(&hmac_vector);
4464
+
4465
+
let compressed_public_key = public_key.serialize();
4466
+
assert_eq!(compressed_public_key.len(),33);
4467
+
4468
+
let trampoline_packet = TrampolineOnionPacket{
4469
+
version:0,
4470
+
public_key,
4471
+
hop_data,
4472
+
hmac,
4473
+
};
4474
+
let encoded_trampoline_packet = trampoline_packet.encode();
4475
+
let expected_eclair_trampoline_packet = <Vec<u8>>::from_hex("0002eec7245d6b7d2ccb30380bfbe2a3648cd7a942653f5aa340edcea1f283686619cff34152f3a36e52ca94e74927203a560392b9cc7ce3c45809c6be52166c24a595716880f95f178bf5b30ca63141f74db6e92795c6130877cfdac3d4bd3087ee73c65d627ddd709112a848cc99e303f3706509aa43ba7c8a88cba175fccf9a8f5016ef06d3b935dbb15196d7ce16dc1a7157845566901d7b2197e52cab4ce487014b14816e5805f9fcacb4f8f88b8ff176f1b94f6ce6b00bc43221130c17d20ef629db7c5f7eafaa166578c720619561dd14b3277db557ec7dcdb793771aef0f2f667cfdbeae3ac8d331c5994779dffb31e5fc0dbdedc0c592ca6d21c18e47fe3528d6975c19517d7e2ea8c5391cf17d0fe30c80913ed887234ccb48808f7ef9425bcd815c3b586210979e3bb286ef2851bf9ce04e28c40a203df98fd648d2f1936fd2f1def0e77eecb277229b4b682322371c0a1dbfcd723a991993df8cc1f2696b84b055b40a1792a29f710295a18fbd351b0f3ff34cd13941131b8278ba79303c89117120eea691738a9954908195143b039dbeed98f26a92585f3d15cf742c953799d3272e0545e9b744be9d3b4cbb079bfc4b35190eee9f59a1d7b41ba2f773179f322dafb4b1af900c289ebd6c").unwrap();
0 commit comments