mirror of
https://github.com/lightningdevkit/rust-lightning.git
synced 2025-01-19 05:43:55 +01:00
Correct route construction in chanmon_consistency
fuzz
bcaba29f92
started returning
pre-built `Route`s from the router in the `chanmon_consistency`
fuzzer. In doing so, it didn't properly fill in the `route_parms`
field which is expected to match the requested parameters. This
causes a debug assertion when sending.
Here we fix this by setting the correct `route_params`.
This commit is contained in:
parent
351d414457
commit
177a6122e6
@ -552,6 +552,10 @@ fn send_payment(
|
||||
.find(|chan| chan.short_channel_id == Some(dest_chan_id))
|
||||
.map(|chan| (chan.next_outbound_htlc_minimum_msat, chan.next_outbound_htlc_limit_msat))
|
||||
.unwrap_or((0, 0));
|
||||
let route_params = RouteParameters::from_payment_params_and_value(
|
||||
PaymentParameters::from_node_id(source.get_our_node_id(), TEST_FINAL_CLTV),
|
||||
amt,
|
||||
);
|
||||
source.router.next_routes.lock().unwrap().push_back(Route {
|
||||
paths: vec![Path {
|
||||
hops: vec![RouteHop {
|
||||
@ -565,12 +569,8 @@ fn send_payment(
|
||||
}],
|
||||
blinded_tail: None,
|
||||
}],
|
||||
route_params: None,
|
||||
route_params: Some(route_params.clone()),
|
||||
});
|
||||
let route_params = RouteParameters::from_payment_params_and_value(
|
||||
PaymentParameters::from_node_id(source.get_our_node_id(), TEST_FINAL_CLTV),
|
||||
amt,
|
||||
);
|
||||
if let Err(err) = source.send_payment(
|
||||
payment_hash,
|
||||
RecipientOnionFields::secret_only(payment_secret),
|
||||
@ -622,6 +622,10 @@ fn send_hop_payment(
|
||||
.map(|chan| (chan.next_outbound_htlc_minimum_msat, chan.next_outbound_htlc_limit_msat))
|
||||
.unwrap_or((0, 0));
|
||||
let first_hop_fee = 50_000;
|
||||
let route_params = RouteParameters::from_payment_params_and_value(
|
||||
PaymentParameters::from_node_id(source.get_our_node_id(), TEST_FINAL_CLTV),
|
||||
amt,
|
||||
);
|
||||
source.router.next_routes.lock().unwrap().push_back(Route {
|
||||
paths: vec![Path {
|
||||
hops: vec![
|
||||
@ -646,12 +650,8 @@ fn send_hop_payment(
|
||||
],
|
||||
blinded_tail: None,
|
||||
}],
|
||||
route_params: None,
|
||||
route_params: Some(route_params.clone()),
|
||||
});
|
||||
let route_params = RouteParameters::from_payment_params_and_value(
|
||||
PaymentParameters::from_node_id(source.get_our_node_id(), TEST_FINAL_CLTV),
|
||||
amt,
|
||||
);
|
||||
if let Err(err) = source.send_payment(
|
||||
payment_hash,
|
||||
RecipientOnionFields::secret_only(payment_secret),
|
||||
|
@ -1226,7 +1226,8 @@ impl OutboundPayments {
|
||||
|
||||
if route.route_params.as_ref() != Some(route_params) {
|
||||
debug_assert!(false,
|
||||
"Routers are expected to return a Route which includes the requested RouteParameters");
|
||||
"Routers are expected to return a Route which includes the requested RouteParameters. Got {:?}, expected {:?}",
|
||||
route.route_params, route_params);
|
||||
route.route_params = Some(route_params.clone());
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user