Skip to content

Commit df975a9

Browse files
committed
f - fallback to one-hop path
1 parent 03d90a3 commit df975a9

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

lightning/src/routing/router.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ impl<G: Deref<Target = NetworkGraph<L>> + Clone, L: Deref, S: Deref, SP: Sized,
9898
const MIN_PEER_CHANNELS: usize = 3;
9999

100100
let network_graph = self.network_graph.deref().read_only();
101-
first_hops.into_iter()
101+
let paths = first_hops.into_iter()
102102
.filter(|details| details.is_public)
103103
.filter(|details| details.counterparty.features.supports_route_blinding())
104104
.filter(|details| amount_msats <= details.inbound_capacity_msat)
@@ -132,7 +132,15 @@ impl<G: Deref<Target = NetworkGraph<L>> + Clone, L: Deref, S: Deref, SP: Sized,
132132
)
133133
})
134134
.take(MAX_PAYMENT_PATHS)
135-
.collect()
135+
.collect::<Result<Vec<_>, _>>();
136+
137+
match paths {
138+
Ok(paths) if !paths.is_empty() => Ok(paths),
139+
_ => {
140+
BlindedPath::one_hop_for_payment(recipient, tlvs, entropy_source, secp_ctx)
141+
.map(|path| vec![path])
142+
},
143+
}
136144
}
137145
}
138146

0 commit comments

Comments
 (0)