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
Expose counterparty forwarding info in ChannelDetails.
Useful for constructing route hints for private channels in invoices.
Co-authored-by: Valentine Wallace <[email protected]>
Co-authored-by: Antoine Riard <[email protected]>
Copy file name to clipboardExpand all lines: lightning/src/ln/channelmanager.rs
+5-1Lines changed: 5 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -39,7 +39,7 @@ use chain::Watch;
39
39
use chain::chaininterface::{BroadcasterInterface,FeeEstimator};
40
40
use chain::channelmonitor::{ChannelMonitor,ChannelMonitorUpdate,ChannelMonitorUpdateStep,ChannelMonitorUpdateErr,HTLC_FAIL_BACK_BUFFER,CLTV_CLAIM_BUFFER,LATENCY_GRACE_PERIOD_BLOCKS,ANTI_REORG_DELAY,MonitorEvent,CLOSED_CHANNEL_UPDATE_ID};
41
41
use chain::transaction::{OutPoint,TransactionData};
42
-
use ln::channel::{Channel,ChannelError};
42
+
use ln::channel::{Channel,ChannelError,CounterpartyForwardingInfo};
43
43
use ln::features::{InitFeatures,NodeFeatures};
44
44
use routing::router::{Route,RouteHop};
45
45
use ln::msgs;
@@ -574,6 +574,9 @@ pub struct ChannelDetails {
574
574
/// True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b)
575
575
/// the peer is connected, and (c) no monitor update failure is pending resolution.
let route = get_route(&our_id,&net_graph_msg_handler.network_graph.read().unwrap(),&nodes[2],None,Some(&our_chans.iter().collect::<Vec<_>>()),&Vec::new(),100,42,Arc::clone(&logger)).unwrap();
1795
1797
assert_eq!(route.paths[0].len(),2);
@@ -1837,6 +1839,7 @@ mod tests {
1837
1839
outbound_capacity_msat:250_000_000,
1838
1840
inbound_capacity_msat:0,
1839
1841
is_live:true,
1842
+
counterparty_forwarding_info:None,
1840
1843
}];
1841
1844
let route = get_route(&our_id,&net_graph_msg_handler.network_graph.read().unwrap(),&nodes[2],None,Some(&our_chans.iter().collect::<Vec<_>>()),&Vec::new(),100,42,Arc::clone(&logger)).unwrap();
1842
1845
assert_eq!(route.paths[0].len(),2);
@@ -1901,6 +1904,7 @@ mod tests {
1901
1904
outbound_capacity_msat:250_000_000,
1902
1905
inbound_capacity_msat:0,
1903
1906
is_live:true,
1907
+
counterparty_forwarding_info:None,
1904
1908
}];
1905
1909
let route = get_route(&our_id,&net_graph_msg_handler.network_graph.read().unwrap(),&nodes[2],None,Some(&our_chans.iter().collect::<Vec<_>>()),&Vec::new(),100,42,Arc::clone(&logger)).unwrap();
1906
1910
assert_eq!(route.paths[0].len(),2);
@@ -2037,6 +2041,7 @@ mod tests {
2037
2041
outbound_capacity_msat:250_000_000,
2038
2042
inbound_capacity_msat:0,
2039
2043
is_live:true,
2044
+
counterparty_forwarding_info:None,
2040
2045
}];
2041
2046
letmut last_hops = last_hops(&nodes);
2042
2047
let route = get_route(&our_id,&net_graph_msg_handler.network_graph.read().unwrap(),&nodes[6],None,Some(&our_chans.iter().collect::<Vec<_>>()),&last_hops.iter().collect::<Vec<_>>(),100,42,Arc::clone(&logger)).unwrap();
@@ -2165,6 +2170,7 @@ mod tests {
2165
2170
outbound_capacity_msat:100000,
2166
2171
inbound_capacity_msat:100000,
2167
2172
is_live:true,
2173
+
counterparty_forwarding_info:None,
2168
2174
}];
2169
2175
let route = get_route(&source_node_id,&NetworkGraph::new(genesis_block(Network::Testnet).header.block_hash()),&target_node_id,None,Some(&our_chans.iter().collect::<Vec<_>>()),&last_hops.iter().collect::<Vec<_>>(),100,42,Arc::new(test_utils::TestLogger::new())).unwrap();
0 commit comments