@atomiqlabs/lp-lib 11.0.2 → 11.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -60,9 +60,17 @@ class ToBtcLnAbs extends ToBtcBaseSwapHandler_1.ToBtcBaseSwapHandler {
|
|
|
60
60
|
//Cancel the swaps where signature is expired
|
|
61
61
|
const isSignatureExpired = yield swapContract.isInitAuthorizationExpired(swap.data, swap);
|
|
62
62
|
if (isSignatureExpired) {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
63
|
+
const isCommitted = yield swapContract.isCommited(swap.data);
|
|
64
|
+
if (!isCommitted) {
|
|
65
|
+
this.swapLogger.info(swap, "processPastSwap(state=SAVED): authorization expired & swap not committed, cancelling swap, invoice: " + swap.pr);
|
|
66
|
+
yield this.removeSwapData(swap, ToBtcLnSwapAbs_1.ToBtcLnSwapState.CANCELED);
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
this.swapLogger.info(swap, "processPastSwap(state=SAVED): swap committed (detected from processPastSwap), invoice: " + swap.pr);
|
|
71
|
+
yield swap.setState(ToBtcLnSwapAbs_1.ToBtcLnSwapState.COMMITED);
|
|
72
|
+
yield this.storageManager.saveData(swap.data.getHash(), swap.getSequence(), swap);
|
|
73
|
+
}
|
|
66
74
|
}
|
|
67
75
|
//Cancel the swaps where lightning invoice is expired
|
|
68
76
|
const decodedPR = yield this.lightning.parsePaymentRequest(swap.pr);
|
package/package.json
CHANGED
|
@@ -142,11 +142,17 @@ export class ToBtcLnAbs extends ToBtcBaseSwapHandler<ToBtcLnSwapAbs, ToBtcLnSwap
|
|
|
142
142
|
//Cancel the swaps where signature is expired
|
|
143
143
|
const isSignatureExpired = await swapContract.isInitAuthorizationExpired(swap.data, swap);
|
|
144
144
|
if(isSignatureExpired) {
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
145
|
+
const isCommitted = await swapContract.isCommited(swap.data);
|
|
146
|
+
if(!isCommitted) {
|
|
147
|
+
this.swapLogger.info(swap, "processPastSwap(state=SAVED): authorization expired & swap not committed, cancelling swap, invoice: "+swap.pr);
|
|
148
|
+
await this.removeSwapData(swap, ToBtcLnSwapState.CANCELED);
|
|
149
|
+
return;
|
|
150
|
+
} else {
|
|
151
|
+
this.swapLogger.info(swap, "processPastSwap(state=SAVED): swap committed (detected from processPastSwap), invoice: "+swap.pr);
|
|
152
|
+
await swap.setState(ToBtcLnSwapState.COMMITED);
|
|
153
|
+
await this.storageManager.saveData(swap.data.getHash(), swap.getSequence(), swap);
|
|
154
|
+
}
|
|
148
155
|
}
|
|
149
|
-
|
|
150
156
|
//Cancel the swaps where lightning invoice is expired
|
|
151
157
|
const decodedPR = await this.lightning.parsePaymentRequest(swap.pr);
|
|
152
158
|
const isInvoiceExpired = decodedPR.expiryEpochMillis < Date.now();
|