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
Failed payments may be retried, but calling get_route may return a Route
with the same failing path. Add a routing::Score trait used to
parameterize get_route, which it calls to determine how much a channel
should be penalized in terms of msats willing to pay to avoid the
channel.
Also, add a Scorer struct that implements routing::Score with a constant
constant penalty. Subsequent changes will allow for more robust scoring
by feeding back payment path success and failure to the scorer via event
handling.
// Next, attempt a keysend payment and make sure it fails.
6051
-
let route = get_route(&nodes[0].node.get_our_node_id(),&nodes[0].net_graph_msg_handler.network_graph,&expected_route.last().unwrap().node.get_our_node_id(),Some(InvoiceFeatures::known()),None,&Vec::new(),100_000,TEST_FINAL_CLTV,&logger).unwrap();
6053
+
let route = get_route(&nodes[0].node.get_our_node_id(),&nodes[0].net_graph_msg_handler.network_graph,&expected_route.last().unwrap().node.get_our_node_id(),Some(InvoiceFeatures::known()),None,&Vec::new(),100_000,TEST_FINAL_CLTV,&logger,&scorer).unwrap();
// To start (2), send a keysend payment but don't claim it.
6078
6080
let payment_preimage = PaymentPreimage([42;32]);
6079
-
let route = get_route(&nodes[0].node.get_our_node_id(),&nodes[0].net_graph_msg_handler.network_graph,&expected_route.last().unwrap().node.get_our_node_id(),Some(InvoiceFeatures::known()),None,&Vec::new(),100_000,TEST_FINAL_CLTV,&logger).unwrap();
6081
+
let route = get_route(&nodes[0].node.get_our_node_id(),&nodes[0].net_graph_msg_handler.network_graph,&expected_route.last().unwrap().node.get_our_node_id(),Some(InvoiceFeatures::known()),None,&Vec::new(),100_000,TEST_FINAL_CLTV,&logger,&scorer).unwrap();
let route = get_route(&nodes[0].node.get_our_node_id(),&nodes[0].net_graph_msg_handler.network_graph,&nodes[1].node.get_our_node_id(),Some(InvoiceFeatures::known()),None,&Vec::new(),10_000,TEST_FINAL_CLTV, nodes[0].logger).unwrap();
7268
+
let scorer = Scorer::new(0);
7269
+
let route = get_route(&nodes[0].node.get_our_node_id(),&nodes[0].net_graph_msg_handler.network_graph,&nodes[1].node.get_our_node_id(),Some(InvoiceFeatures::known()),None,&Vec::new(),10_000,TEST_FINAL_CLTV, nodes[0].logger,&scorer).unwrap();
let net_graph_msg_handler0 = &nodes[0].net_graph_msg_handler;
99
101
let net_graph_msg_handler1 = &nodes[1].net_graph_msg_handler;
100
-
let route_1 = get_route(&nodes[0].node.get_our_node_id(),&net_graph_msg_handler0.network_graph,&nodes[1].node.get_our_node_id(),Some(InvoiceFeatures::known()),None,&[],100000,TEST_FINAL_CLTV,&logger).unwrap();
101
-
let route_2 = get_route(&nodes[1].node.get_our_node_id(),&net_graph_msg_handler1.network_graph,&nodes[0].node.get_our_node_id(),Some(InvoiceFeatures::known()),None,&[],100000,TEST_FINAL_CLTV,&logger).unwrap();
102
+
let route_1 = get_route(&nodes[0].node.get_our_node_id(),&net_graph_msg_handler0.network_graph,&nodes[1].node.get_our_node_id(),Some(InvoiceFeatures::known()),None,&[],100000,TEST_FINAL_CLTV,&logger,&scorer).unwrap();
103
+
let route_2 = get_route(&nodes[1].node.get_our_node_id(),&net_graph_msg_handler1.network_graph,&nodes[0].node.get_our_node_id(),Some(InvoiceFeatures::known()),None,&[],100000,TEST_FINAL_CLTV,&logger,&scorer).unwrap();
0 commit comments