Skip to content

Commit

Permalink
Merge pull request #202 from synonymdev/timeout-fix
Browse files Browse the repository at this point in the history
fix: remove js payment timeout
  • Loading branch information
Jasonvdb authored Jan 18, 2024
2 parents 77600e9 + c887e97 commit 213b26a
Showing 1 changed file with 0 additions and 18 deletions.
18 changes: 0 additions & 18 deletions lib/src/lightning-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1262,28 +1262,10 @@ class LightningManager {
}
};

/**
* ldk.pay helper that subscribes to and returns pay event success/failures and times out after a specified period of time.
* @param {string} paymentRequest
* @param {number} [amountSats]
* @param {number} [timeout]
* @returns {Promise<Result<TChannelManagerPaymentSent>>}
*/
payWithTimeout = async ({
paymentRequest,
amountSats,
timeout = 20000,
}: TPaymentTimeoutReq): Promise<Result<TChannelManagerPaymentSent>> => {
return promiseTimeout(
timeout,
this.subscribeAndPay({ paymentRequest, amountSats, timeout }),
);
};

private subscribeAndPay = async ({
paymentRequest,
amountSats,
timeout = 20000,
}: TPaymentReq): Promise<Result<TChannelManagerPaymentSent>> => {
return new Promise(async (resolve) => {
await ldk.writeToLogFile(
Expand Down

0 comments on commit 213b26a

Please sign in to comment.