projects
/
rust-lightning
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Handle only-path-overflows-fee in get_route and avoid PubKey::new()
[rust-lightning]
/
src
/
ln
/
router.rs
diff --git
a/src/ln/router.rs
b/src/ln/router.rs
index 5aaea4f67de130a8e64dcaf3a152d1ece433c741..bc9c868add32b948052df9b9cc9a4e6a6213b590 100644
(file)
--- a/
src/ln/router.rs
+++ b/
src/ln/router.rs
@@
-95,7
+95,7
@@
impl NetworkMap {
pub struct RouteHint {
pub src_node_id: PublicKey,
pub short_channel_id: u64,
pub struct RouteHint {
pub src_node_id: PublicKey,
pub short_channel_id: u64,
- pub fee_base_msat: u
64
,
+ pub fee_base_msat: u
32
,
pub fee_proportional_millionths: u32,
pub cltv_expiry_delta: u16,
pub htlc_minimum_msat: u64,
pub fee_proportional_millionths: u32,
pub cltv_expiry_delta: u16,
pub htlc_minimum_msat: u64,
@@
-448,7
+448,7
@@
impl Router {
node.lowest_inbound_channel_fee_base_msat,
node.lowest_inbound_channel_fee_proportional_millionths,
RouteHop {
node.lowest_inbound_channel_fee_base_msat,
node.lowest_inbound_channel_fee_proportional_millionths,
RouteHop {
- pubkey:
PublicKey::new
(),
+ pubkey:
$dest_node_id.clone
(),
short_channel_id: 0,
fee_msat: 0,
cltv_expiry_delta: 0,
short_channel_id: 0,
fee_msat: 0,
cltv_expiry_delta: 0,
@@
-537,7
+537,10
@@
impl Router {
if pubkey == network.our_node_id {
let mut res = vec!(dist.remove(&network.our_node_id).unwrap().3);
while res.last().unwrap().pubkey != *target {
if pubkey == network.our_node_id {
let mut res = vec!(dist.remove(&network.our_node_id).unwrap().3);
while res.last().unwrap().pubkey != *target {
- let new_entry = dist.remove(&res.last().unwrap().pubkey).unwrap().3;
+ let new_entry = match dist.remove(&res.last().unwrap().pubkey) {
+ Some(hop) => hop.3,
+ None => return Err(HandleError{err: "Failed to find a non-fee-overflowing path to the given destination", action: None}),
+ };
res.last_mut().unwrap().fee_msat = new_entry.fee_msat;
res.last_mut().unwrap().cltv_expiry_delta = new_entry.cltv_expiry_delta;
res.push(new_entry);
res.last_mut().unwrap().fee_msat = new_entry.fee_msat;
res.last_mut().unwrap().cltv_expiry_delta = new_entry.cltv_expiry_delta;
res.push(new_entry);