hops: vec!(
RouteHop {
pubkey: PublicKey::from_slice(&secp_ctx, &hex::decode("02eec7245d6b7d2ccb30380bfbe2a3648cd7a942653f5aa340edcea1f283686619").unwrap()[..]).unwrap(),
- short_channel_id: 0, fee_msat: 0, cltv_expiry_delta: 0 // Test vectors are garbage and not generateble from a RouteHop, we fill in payloads manually
+ short_channel_id: 0, fee_msat: 0, cltv_expiry_delta: 0, channel_update_timestamp: 0 // Test vectors are garbage and not generateble from a RouteHop, we fill in payloads manually
},
RouteHop {
pubkey: PublicKey::from_slice(&secp_ctx, &hex::decode("0324653eac434488002cc06bbfb7f10fe18991e35f9fe4302dbea6d2353dc0ab1c").unwrap()[..]).unwrap(),
- short_channel_id: 0, fee_msat: 0, cltv_expiry_delta: 0 // Test vectors are garbage and not generateble from a RouteHop, we fill in payloads manually
+ short_channel_id: 0, fee_msat: 0, cltv_expiry_delta: 0, channel_update_timestamp: 0 // Test vectors are garbage and not generateble from a RouteHop, we fill in payloads manually
},
RouteHop {
pubkey: PublicKey::from_slice(&secp_ctx, &hex::decode("027f31ebc5462c1fdce1b737ecff52d37d75dea43ce11c74d25aa297165faa2007").unwrap()[..]).unwrap(),
- short_channel_id: 0, fee_msat: 0, cltv_expiry_delta: 0 // Test vectors are garbage and not generateble from a RouteHop, we fill in payloads manually
+ short_channel_id: 0, fee_msat: 0, cltv_expiry_delta: 0, channel_update_timestamp: 0 // Test vectors are garbage and not generateble from a RouteHop, we fill in payloads manually
},
RouteHop {
pubkey: PublicKey::from_slice(&secp_ctx, &hex::decode("032c0b7cf95324a07d05398b240174dc0c2be444d96b159aa6c7f7b1e668680991").unwrap()[..]).unwrap(),
- short_channel_id: 0, fee_msat: 0, cltv_expiry_delta: 0 // Test vectors are garbage and not generateble from a RouteHop, we fill in payloads manually
+ short_channel_id: 0, fee_msat: 0, cltv_expiry_delta: 0, channel_update_timestamp: 0 // Test vectors are garbage and not generateble from a RouteHop, we fill in payloads manually
},
RouteHop {
pubkey: PublicKey::from_slice(&secp_ctx, &hex::decode("02edabbd16b41c8371b92ef2f04c1185b4f03b6dcd52ba9b78d9d7c89c8f221145").unwrap()[..]).unwrap(),
- short_channel_id: 0, fee_msat: 0, cltv_expiry_delta: 0 // Test vectors are garbage and not generateble from a RouteHop, we fill in payloads manually
+ short_channel_id: 0, fee_msat: 0, cltv_expiry_delta: 0, channel_update_timestamp: 0 // Test vectors are garbage and not generateble from a RouteHop, we fill in payloads manually
},
),
};
pubkey: nodes[2].node.get_our_node_id(),
short_channel_id: chan_2.0.contents.short_channel_id,
fee_msat: 0,
- cltv_expiry_delta: chan_3.0.contents.cltv_expiry_delta as u32
+ cltv_expiry_delta: chan_3.0.contents.cltv_expiry_delta as u32,
+ channel_update_timestamp: 0,
});
hops.push(RouteHop {
pubkey: nodes[3].node.get_our_node_id(),
short_channel_id: chan_3.0.contents.short_channel_id,
fee_msat: 0,
- cltv_expiry_delta: chan_4.1.contents.cltv_expiry_delta as u32
+ cltv_expiry_delta: chan_4.1.contents.cltv_expiry_delta as u32,
+ channel_update_timestamp: 0,
});
hops.push(RouteHop {
pubkey: nodes[1].node.get_our_node_id(),
short_channel_id: chan_4.0.contents.short_channel_id,
fee_msat: 1000000,
cltv_expiry_delta: TEST_FINAL_CLTV,
+ channel_update_timestamp: 0,
});
hops[1].fee_msat = chan_4.1.contents.fee_base_msat as u64 + chan_4.1.contents.fee_proportional_millionths as u64 * hops[2].fee_msat as u64 / 1000000;
hops[0].fee_msat = chan_3.0.contents.fee_base_msat as u64 + chan_3.0.contents.fee_proportional_millionths as u64 * hops[1].fee_msat as u64 / 1000000;
pubkey: nodes[3].node.get_our_node_id(),
short_channel_id: chan_4.0.contents.short_channel_id,
fee_msat: 0,
- cltv_expiry_delta: chan_3.1.contents.cltv_expiry_delta as u32
+ cltv_expiry_delta: chan_3.1.contents.cltv_expiry_delta as u32,
+ channel_update_timestamp: 0,
});
hops.push(RouteHop {
pubkey: nodes[2].node.get_our_node_id(),
short_channel_id: chan_3.0.contents.short_channel_id,
fee_msat: 0,
- cltv_expiry_delta: chan_2.1.contents.cltv_expiry_delta as u32
+ cltv_expiry_delta: chan_2.1.contents.cltv_expiry_delta as u32,
+ channel_update_timestamp: 0,
});
hops.push(RouteHop {
pubkey: nodes[1].node.get_our_node_id(),
short_channel_id: chan_2.0.contents.short_channel_id,
fee_msat: 1000000,
cltv_expiry_delta: TEST_FINAL_CLTV,
+ channel_update_timestamp: 0,
});
hops[1].fee_msat = chan_2.1.contents.fee_base_msat as u64 + chan_2.1.contents.fee_proportional_millionths as u64 * hops[2].fee_msat as u64 / 1000000;
hops[0].fee_msat = chan_3.1.contents.fee_base_msat as u64 + chan_3.1.contents.fee_proportional_millionths as u64 * hops[1].fee_msat as u64 / 1000000;
/// The CLTV delta added for this hop. For the last hop, this should be the full CLTV value
/// expected at the destination, in excess of the current block height.
pub cltv_expiry_delta: u32,
+ /// channel update timestamp of the outbound channel of each hop when this route is
+ /// calculated
+ pub channel_update_timestamp: u32,
}
/// A route from us through the network to a destination
pub struct RouteHint {
/// The node_id of the non-target end of the route
pub src_node_id: PublicKey,
+ /// last update
+ pub last_update: u32,
/// The short_channel_id of this channel
pub short_channel_id: u64,
/// The static msat-denominated fee which must be paid to use this channel
struct DummyDirectionalChannelInfo {
src_node_id: PublicKey,
+ last_update: u32,
cltv_expiry_delta: u32,
htlc_minimum_msat: u64,
fee_base_msat: u32,
let dummy_directional_info = DummyDirectionalChannelInfo { // used for first_hops routes
src_node_id: network.our_node_id.clone(),
+ last_update: 0,
cltv_expiry_delta: 0,
htlc_minimum_msat: 0,
fee_base_msat: 0,
short_channel_id,
fee_msat: final_value_msat,
cltv_expiry_delta: final_cltv,
+ channel_update_timestamp: 0, //TODO: related to local channel_update_handling?
}],
});
}
short_channel_id: 0,
fee_msat: 0,
cltv_expiry_delta: 0,
+ channel_update_timestamp: $directional_info.last_update,
})
});
if $directional_info.src_node_id != network.our_node_id {
short_channel_id: $chan_id.clone(),
fee_msat: new_fee, // This field is ignored on the last-hop anyway
cltv_expiry_delta: $directional_info.cltv_expiry_delta as u32,
+ channel_update_timestamp: $directional_info.last_update,
}
}
}
let mut last_hops = vec!(RouteHint {
src_node_id: node4.clone(),
short_channel_id: 8,
+ last_update: 0,
fee_base_msat: 0,
fee_proportional_millionths: 0,
cltv_expiry_delta: (8 << 8) | 1,
}, RouteHint {
src_node_id: node5.clone(),
short_channel_id: 9,
+ last_update: 0,
fee_base_msat: 1001,
fee_proportional_millionths: 0,
cltv_expiry_delta: (9 << 8) | 1,
}, RouteHint {
src_node_id: node6.clone(),
short_channel_id: 10,
+ last_update: 0,
fee_base_msat: 0,
fee_proportional_millionths: 0,
cltv_expiry_delta: (10 << 8) | 1,