Skip to content
This repository was archived by the owner on Feb 9, 2026. It is now read-only.

Commit 5558c5d

Browse files
committed
fix: return early in getInvoiceFromPaymentHash
1 parent 8586e5f commit 5558c5d

1 file changed

Lines changed: 1 addition & 4 deletions

File tree

lib/src/lightning-manager.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1491,18 +1491,15 @@ class LightningManager {
14911491
paymentHash: string,
14921492
): Promise<TInvoice | undefined> => {
14931493
const invoices = await this.getBolt11Invoices();
1494-
let invoice: TInvoice | undefined;
14951494
for (let index = 0; index < invoices.length; index++) {
14961495
const paymentRequest = invoices[index];
14971496
const invoiceRes = await ldk.decode({ paymentRequest });
14981497
if (invoiceRes.isOk()) {
14991498
if (invoiceRes.value.payment_hash === paymentHash) {
1500-
invoice = invoiceRes.value;
1499+
return invoiceRes.value;
15011500
}
15021501
}
15031502
}
1504-
1505-
return invoice;
15061503
};
15071504

15081505
private getLdkSpendableOutputs = async (): Promise<TLdkSpendableOutputs> => {

0 commit comments

Comments
 (0)