let value_msat = if cur_value_msat == 0 { hop.fee_msat } else { cur_value_msat };
let cltv = if cur_cltv == starting_htlc_offset { hop.cltv_expiry_delta + starting_htlc_offset } else { cur_cltv };
res.insert(0, msgs::OnionHopData {
- realm: 0,
- data: msgs::OnionRealm0HopData {
- short_channel_id: last_short_channel_id,
- amt_to_forward: value_msat,
- outgoing_cltv_value: cltv,
- },
+ format: msgs::OnionHopDataFormat::Legacy,
+ short_channel_id: last_short_channel_id,
+ amt_to_forward: value_msat,
+ outgoing_cltv_value: cltv,
hmac: [0; 32],
});
cur_value_msat += hop.fee_msat;
// Test vectors below are flat-out wrong: they claim to set outgoing_cltv_value to non-0 :/
let payloads = vec!(
msgs::OnionHopData {
- realm: 0,
- data: msgs::OnionRealm0HopData {
- short_channel_id: 0,
- amt_to_forward: 0,
- outgoing_cltv_value: 0,
- },
+ format: msgs::OnionHopDataFormat::Legacy,
+ short_channel_id: 0,
+ amt_to_forward: 0,
+ outgoing_cltv_value: 0,
hmac: [0; 32],
},
msgs::OnionHopData {
- realm: 0,
- data: msgs::OnionRealm0HopData {
- short_channel_id: 0x0101010101010101,
- amt_to_forward: 0x0100000001,
- outgoing_cltv_value: 0,
- },
+ format: msgs::OnionHopDataFormat::Legacy,
+ short_channel_id: 0x0101010101010101,
+ amt_to_forward: 0x0100000001,
+ outgoing_cltv_value: 0,
hmac: [0; 32],
},
msgs::OnionHopData {
- realm: 0,
- data: msgs::OnionRealm0HopData {
- short_channel_id: 0x0202020202020202,
- amt_to_forward: 0x0200000002,
- outgoing_cltv_value: 0,
- },
+ format: msgs::OnionHopDataFormat::Legacy,
+ short_channel_id: 0x0202020202020202,
+ amt_to_forward: 0x0200000002,
+ outgoing_cltv_value: 0,
hmac: [0; 32],
},
msgs::OnionHopData {
- realm: 0,
- data: msgs::OnionRealm0HopData {
- short_channel_id: 0x0303030303030303,
- amt_to_forward: 0x0300000003,
- outgoing_cltv_value: 0,
- },
+ format: msgs::OnionHopDataFormat::Legacy,
+ short_channel_id: 0x0303030303030303,
+ amt_to_forward: 0x0300000003,
+ outgoing_cltv_value: 0,
hmac: [0; 32],
},
msgs::OnionHopData {
- realm: 0,
- data: msgs::OnionRealm0HopData {
- short_channel_id: 0x0404040404040404,
- amt_to_forward: 0x0400000004,
- outgoing_cltv_value: 0,
- },
+ format: msgs::OnionHopDataFormat::Legacy,
+ short_channel_id: 0x0404040404040404,
+ amt_to_forward: 0x0400000004,
+ outgoing_cltv_value: 0,
hmac: [0; 32],
},
);