Skip to content

Commit 2c1a922

Browse files
committed
f - limit number of invoice requests
1 parent d1227d2 commit 2c1a922

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
@@ -7201,7 +7201,11 @@ where
72017201
};
72027202
pending_offers_messages.push(message);
72037203
} else {
7204-
for path in offer.paths() {
7204+
// Send as many invoice requests as there are paths in the offer (with an upper bound).
7205+
// Using only one path could result in a failure if the path no longer exists. But only
7206+
// one invoice for a given payment id will be paid, even if more than one is received.
7207+
const REQUEST_LIMIT: usize = 10;
7208+
for path in offer.paths().into_iter().take(REQUEST_LIMIT) {
72057209
let message = PendingOnionMessage {
72067210
contents: OffersMessage::InvoiceRequest(invoice_request.clone()),
72077211
destination: Destination::BlindedPath(path.clone()),

0 commit comments

Comments
 (0)