Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: return early in getInvoiceFromPaymentHash #173

Merged
merged 1 commit into from
Oct 4, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions lib/src/lightning-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1491,18 +1491,15 @@
paymentHash: string,
): Promise<TInvoice | undefined> => {
const invoices = await this.getBolt11Invoices();
let invoice: TInvoice | undefined;
for (let index = 0; index < invoices.length; index++) {
const paymentRequest = invoices[index];
const invoiceRes = await ldk.decode({ paymentRequest });
if (invoiceRes.isOk()) {
if (invoiceRes.value.payment_hash === paymentHash) {
invoice = invoiceRes.value;
return invoiceRes.value;
}
}
}

return invoice;
};

private getLdkSpendableOutputs = async (): Promise<TLdkSpendableOutputs> => {
Expand Down Expand Up @@ -1872,7 +1869,7 @@
}

private onChannelManagerPendingHtlcsForwardable(
res: TChannelManagerPendingHtlcsForwardable,

Check warning on line 1872 in lib/src/lightning-manager.ts

View workflow job for this annotation

GitHub Actions / Run lint check

'res' is defined but never used. Allowed unused args must match /^_/u
): void {
ldk.processPendingHtlcForwards().catch(console.error);
}
Expand Down
Loading