crosslightning-intermediary
Advanced tools
Comparing version 3.3.2 to 3.3.3
@@ -42,5 +42,15 @@ "use strict"; | ||
if (swap.state === FromBtcLnSwapAbs_1.FromBtcLnSwapState.RECEIVED) { | ||
if (swap.signature != null && (yield this.swapContract.isInitAuthorizationExpired(swap.data, swap.timeout, swap.prefix, swap.signature, swap.nonce))) { | ||
const parsedPR = bolt11.decode(swap.pr); | ||
cancelInvoices.push(parsedPR.tagsObject.payment_hash); | ||
const parsedPR = bolt11.decode(swap.pr); | ||
console.log("[From BTC-LN: Swap received check] Swap in received state check for expiry: " + parsedPR.tagsObject.payment_hash); | ||
console.log("[From BTC-LN: Swap received check] Swap signature: " + swap.signature); | ||
if (swap.signature != null) { | ||
const isAuthorizationExpired = yield this.swapContract.isInitAuthorizationExpired(swap.data, swap.timeout, swap.prefix, swap.signature, swap.nonce); | ||
console.log("[From BTC-LN: Swap received check] Swap auth expired: " + isAuthorizationExpired); | ||
if (isAuthorizationExpired) { | ||
const isCommited = yield this.swapContract.isCommited(swap.data); | ||
if (!isCommited) { | ||
cancelInvoices.push(parsedPR.tagsObject.payment_hash); | ||
} | ||
continue; | ||
} | ||
} | ||
@@ -47,0 +57,0 @@ } |
@@ -30,2 +30,6 @@ "use strict"; | ||
this.secret = prOrObj.secret; | ||
this.nonce = prOrObj.nonce; | ||
this.prefix = prOrObj.prefix; | ||
this.timeout = prOrObj.timeout; | ||
this.signature = prOrObj.signature; | ||
} | ||
@@ -39,3 +43,7 @@ } | ||
data: this.data == null ? null : this.data.serialize(), | ||
secret: this.secret | ||
secret: this.secret, | ||
nonce: this.nonce, | ||
prefix: this.prefix, | ||
timeout: this.timeout, | ||
signature: this.signature | ||
}; | ||
@@ -42,0 +50,0 @@ } |
{ | ||
"name": "crosslightning-intermediary", | ||
"version": "3.3.2", | ||
"version": "3.3.3", | ||
"description": "Main functionality implementation for intermediary node, easily extensible to any chain", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
@@ -82,5 +82,15 @@ import * as BN from "bn.js"; | ||
if(swap.state===FromBtcLnSwapState.RECEIVED) { | ||
if(swap.signature!=null && await this.swapContract.isInitAuthorizationExpired(swap.data, swap.timeout, swap.prefix, swap.signature, swap.nonce)) { | ||
const parsedPR = bolt11.decode(swap.pr); | ||
cancelInvoices.push(parsedPR.tagsObject.payment_hash); | ||
const parsedPR = bolt11.decode(swap.pr); | ||
console.log("[From BTC-LN: Swap received check] Swap in received state check for expiry: "+parsedPR.tagsObject.payment_hash); | ||
console.log("[From BTC-LN: Swap received check] Swap signature: "+swap.signature); | ||
if(swap.signature!=null) { | ||
const isAuthorizationExpired = await this.swapContract.isInitAuthorizationExpired(swap.data, swap.timeout, swap.prefix, swap.signature, swap.nonce); | ||
console.log("[From BTC-LN: Swap received check] Swap auth expired: "+isAuthorizationExpired); | ||
if(isAuthorizationExpired) { | ||
const isCommited = await this.swapContract.isCommited(swap.data); | ||
if(!isCommited) { | ||
cancelInvoices.push(parsedPR.tagsObject.payment_hash); | ||
} | ||
continue; | ||
} | ||
} | ||
@@ -87,0 +97,0 @@ } |
@@ -43,2 +43,6 @@ import * as BN from "bn.js"; | ||
this.secret = prOrObj.secret; | ||
this.nonce = prOrObj.nonce; | ||
this.prefix = prOrObj.prefix; | ||
this.timeout = prOrObj.timeout; | ||
this.signature = prOrObj.signature; | ||
} | ||
@@ -53,3 +57,7 @@ } | ||
data: this.data==null ? null : this.data.serialize(), | ||
secret: this.secret | ||
secret: this.secret, | ||
nonce: this.nonce, | ||
prefix: this.prefix, | ||
timeout: this.timeout, | ||
signature: this.signature | ||
} | ||
@@ -56,0 +64,0 @@ } |
317160
6824