Skip to content

Commit

Permalink
LNC: PayLightningInvoice: temporarily disable forced timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
kaloudis committed Oct 22, 2023
1 parent 0c3e290 commit 44aa9ac
Showing 1 changed file with 5 additions and 24 deletions.
29 changes: 5 additions & 24 deletions backends/LightningNodeConnect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import OpenChannelRequest from '../models/OpenChannelRequest';

import Base64Utils from '../utils/Base64Utils';
import { snakeize } from '../utils/DataFormatUtils';
import { localeString } from '../utils/LocaleUtils';
import VersionUtils from '../utils/VersionUtils';

import { Hash as sha256Hash } from 'fast-sha256';
Expand Down Expand Up @@ -192,30 +191,12 @@ export default class LightningNodeConnect {
await this.lnc.lnd.lightning
.decodePayReq({ pay_req: urlParams && urlParams[0] })
.then((data: lnrpc.PayReq) => snakeize(data));
payLightningInvoice = async (data: any) => {
payLightningInvoice = (data: any) => {
if (data.pubkey) delete data.pubkey;

const forcedTimeout = async (time_ms: number, response: any) => {
await new Promise((res) => setTimeout(res, time_ms));
return response;
};

const call = () =>
this.lnc.lnd.router.sendPaymentV2({
...data,
allow_self_payment: true
});

const result: any = await Promise.race([
forcedTimeout((data.timeout_seconds + 1) * 1000, {
payment_error: localeString(
'views.SendingLightning.paymentTimedOut'
)
}),
call()
]);

return result;
return this.lnc.lnd.router.sendPaymentV2({
...data,
allow_self_payment: true
});
};
closeChannel = async (urlParams?: Array<string>) => {
let params;
Expand Down

0 comments on commit 44aa9ac

Please sign in to comment.