Skip to content

Commit 07df5cb

Browse files
committed
f - limit the number of blinded payment paths computed
1 parent ca3cc60 commit 07df5cb

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lightning/src/routing/router.rs

+4
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,9 @@ impl< G: Deref<Target = NetworkGraph<L>> + Clone, L: Deref, S: Deref, SP: Sized,
9090
&self, recipient: PublicKey, first_hops: Vec<ChannelDetails>, tlvs: ReceiveTlvs,
9191
amount_msats: u64, entropy_source: &ES, secp_ctx: &Secp256k1<T>
9292
) -> Result<Vec<(BlindedPayInfo, BlindedPath)>, ()> {
93+
// Limit the number of blinded paths that are computed.
94+
const MAX_PAYMENT_PATHS: usize = 3;
95+
9396
// Ensure peers have at least three channels so that it is more difficult to infer the
9497
// recipient's node_id.
9598
const MIN_PEER_CHANNELS: usize = 3;
@@ -127,6 +130,7 @@ impl< G: Deref<Target = NetworkGraph<L>> + Clone, L: Deref, S: Deref, SP: Sized,
127130
&[forward_node], recipient, tlvs.clone(), u64::MAX, entropy_source, secp_ctx
128131
)
129132
})
133+
.take(MAX_PAYMENT_PATHS)
130134
.collect()
131135
}
132136
}

0 commit comments

Comments
 (0)