Skip to content

Commit a2fe5b1

Browse files
committed
Consider channels with one direction useless for routing
This is actually only useful when we just restarted and received an outdated channel update, which we keep for STALE_CHANNEL_UPDATE_AGE_LIMIT_SECS to give it a chance to send a channel update. During that time, we still should not be used it for routing.
1 parent 427ced6 commit a2fe5b1

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lightning/src/routing/router.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1274,7 +1274,9 @@ where L::Target: Logger {
12741274
for chan_id in $node.channels.iter() {
12751275
let chan = network_channels.get(chan_id).unwrap();
12761276
if !chan.features.requires_unknown_bits() {
1277-
if let Some((directed_channel, source)) = chan.as_directed_to(&$node_id) {
1277+
// We consider channels with only one direction filled useless,
1278+
// so we should check that both directions are present.
1279+
if chan.as_directed_from(&$node_id).is_some() && let Some((directed_channel, source)) = chan.as_directed_to(&$node_id) {
12781280
if first_hops.is_none() || *source != our_node_id {
12791281
if directed_channel.direction().enabled {
12801282
let candidate = CandidateRouteHop::PublicHop {

0 commit comments

Comments
 (0)