Skip to content

Commit 9f980fc

Browse files
committed
f - limit number of invoice requests
1 parent 0e7fd4c commit 9f980fc

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lightning/src/ln/channelmanager.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7203,7 +7203,11 @@ where
72037203
};
72047204
pending_offers_messages.push(message);
72057205
} else {
7206-
for path in offer.paths() {
7206+
// Send as many invoice requests as there are paths in the offer (with an upper bound).
7207+
// Using only one path could result in a failure if the path no longer exists. But only
7208+
// one invoice for a given payment id will be paid, even if more than one is received.
7209+
const REQUEST_LIMIT: usize = 10;
7210+
for path in offer.paths().into_iter().take(REQUEST_LIMIT) {
72077211
let message = PendingOnionMessage {
72087212
contents: OffersMessage::InvoiceRequest(invoice_request.clone()),
72097213
destination: Destination::BlindedPath(path.clone()),

0 commit comments

Comments
 (0)