Skip to content

Commit 56d30d0

Browse files
authored
Merge pull request #6330 from BitGo/BTC-2219-handle-get-transfer-error
fix: not send a error if get transfer fail lightning
2 parents a8a9102 + 47a0568 commit 56d30d0

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

modules/abstract-lightning/src/wallet/lightning.ts

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,14 @@ export class LightningWallet implements ILightningWallet {
311311
);
312312

313313
const coinSpecific = transactionRequestSend.transactions?.[0]?.unsignedTx?.coinSpecific;
314-
const updatedTransfer = await this.wallet.getTransfer({ id: transfer.id });
314+
let updatedTransfer: any = undefined;
315+
try {
316+
updatedTransfer = await this.wallet.getTransfer({ id: transfer.id });
317+
} catch (e) {
318+
// If transfer is not found which is possible in cases where the payment has definitely failed
319+
// Or even if some unknown error occurs, we will not throw an error here
320+
// We still want to return the txRequestId, txRequestState and paymentStatus.
321+
}
315322

316323
return {
317324
txRequestId: transactionRequestCreate.txRequestId,
@@ -370,7 +377,14 @@ export class LightningWallet implements ILightningWallet {
370377
reqId
371378
);
372379

373-
const updatedTransfer = await this.wallet.getTransfer({ id: transfer.id });
380+
let updatedTransfer: any = undefined;
381+
try {
382+
updatedTransfer = await this.wallet.getTransfer({ id: transfer.id });
383+
} catch (e) {
384+
// If transfer is not found which is possible in cases where the withdraw has definitely failed
385+
// Or even if some unknown error occurs, we will not throw an error here
386+
// We still want to return the txRequestId and txRequestState.
387+
}
374388

375389
return {
376390
txRequestId: transactionRequestCreate.txRequestId,

0 commit comments

Comments
 (0)