Skip to content
This repository has been archived by the owner on Oct 3, 2023. It is now read-only.

Commit

Permalink
[WIP] fix: Find a route to custom output counterparty
Browse files Browse the repository at this point in the history
We are failing to find the route when calling `find_route` i.e. what
is commented out with this patch.

Since we are not supporting multihop, can we just build the `Route`
ourselves?
  • Loading branch information
luckysori committed Nov 3, 2022
1 parent af23fcb commit 80a9c15
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions lightning-invoice/src/payment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ use crate::Invoice;

use bitcoin_hashes::Hash;
use bitcoin_hashes::sha256::Hash as Sha256;
use lightning::ln::features::NodeFeatures;

use crate::prelude::*;
use lightning::io;
Expand Down Expand Up @@ -452,10 +453,23 @@ where
final_cltv_expiry_delta,
};

let route = self.router.find_route(
&self.payer.node_id(), &route_params, &PaymentHash([0u8;32]), None,
self.create_inflight_map(),
).map_err(|e| PaymentError::Routing(e))?;
// let route = self.router.find_route(
// &self.payer.node_id(), &route_params, &PaymentHash([0u8;32]), None,
// self.create_inflight_map(),
// ).map_err(|e| PaymentError::Routing(e))?;

let route_hop =
RouteHop {
pubkey,
node_features: NodeFeatures::empty(),
short_channel_id: todo!(),
channel_features: todo!(),
fee_msat: todo!(),
cltv_expiry_delta: todo!()
};

let route = Route {
paths: vec![vec![route_hop]], payment_params: None };

self.payer.add_custom_output(&route).map_err(PaymentError::CreatingCustomOutput)?;

Expand Down

0 comments on commit 80a9c15

Please sign in to comment.