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
use ln::msgs::{Features,FeatureContextChannel,FeatureContextNode,OptionalField,OnionErrorPacket};
1574
+
use ln::msgs::{Features,FeatureContextChannel,FeatureContextNode,OptionalField,OnionErrorPacket,OnionHopDataFormat};
1517
1575
use ln::channelmanager::{PaymentPreimage,PaymentHash};
1518
-
use util::ser::Writeable;
1576
+
use util::ser::{Writeable,Readable};
1519
1577
1520
1578
use bitcoin_hashes::sha256d::HashasSha256dHash;
1521
1579
use bitcoin_hashes::hex::FromHex;
@@ -1528,6 +1586,7 @@ mod tests {
1528
1586
use secp256k1::{Secp256k1,Message};
1529
1587
1530
1588
use std::marker::PhantomData;
1589
+
use std::io::Cursor;
1531
1590
1532
1591
#[test]
1533
1592
fnencoding_channel_reestablish_no_secret(){
@@ -2178,4 +2237,54 @@ mod tests {
2178
2237
let target_value = hex::decode("004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap();
2179
2238
assert_eq!(encoded_value, target_value);
2180
2239
}
2240
+
2241
+
#[test]
2242
+
fnencoding_legacy_onion_hop_data(){
2243
+
let msg = msgs::OnionHopData{
2244
+
format:OnionHopDataFormat::Legacy{
2245
+
short_channel_id:0xdeadbeef1bad1dea,
2246
+
},
2247
+
amt_to_forward:0x0badf00d01020304,
2248
+
outgoing_cltv_value:0xffffffff,
2249
+
};
2250
+
let encoded_value = msg.encode();
2251
+
let target_value = hex::decode("00deadbeef1bad1dea0badf00d01020304ffffffff000000000000000000000000").unwrap();
2252
+
assert_eq!(encoded_value, target_value);
2253
+
}
2254
+
2255
+
#[test]
2256
+
fnencoding_nonfinal_onion_hop_data(){
2257
+
letmut msg = msgs::OnionHopData{
2258
+
format:OnionHopDataFormat::NonFinalNode{
2259
+
short_channel_id:0xdeadbeef1bad1dea,
2260
+
},
2261
+
amt_to_forward:0x0badf00d01020304,
2262
+
outgoing_cltv_value:0xffffffff,
2263
+
};
2264
+
let encoded_value = msg.encode();
2265
+
let target_value = hex::decode("1a02080badf00d010203040404ffffffff0608deadbeef1bad1dea").unwrap();
0 commit comments