@atomiqlabs/lp-lib 16.0.4 → 16.0.5
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.
- package/dist/swaps/escrow/EscrowHandler.js +2 -0
- package/dist/swaps/spv_vault_swap/SpvVaultSwapHandler.d.ts +0 -1
- package/dist/swaps/spv_vault_swap/SpvVaultSwapHandler.js +2 -14
- package/package.json +1 -1
- package/src/swaps/escrow/EscrowHandler.ts +2 -1
- package/src/swaps/spv_vault_swap/SpvVaultSwapHandler.ts +2 -13
|
@@ -74,6 +74,8 @@ class EscrowHandler extends SwapHandler_1.SwapHandler {
|
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
76
|
async removeSwapData(swap, ultimateState) {
|
|
77
|
+
this.inflightSwaps.delete(swap.getIdentifier());
|
|
78
|
+
this.logger.debug("removeSwapData(): Removing in-flight swap, current in-flight swaps: " + this.inflightSwaps.size);
|
|
77
79
|
if (ultimateState != null)
|
|
78
80
|
await swap.setState(ultimateState);
|
|
79
81
|
if (swap != null)
|
|
@@ -64,6 +64,5 @@ export declare class SpvVaultSwapHandler extends SwapHandler<SpvVaultSwap, SpvVa
|
|
|
64
64
|
startRestServer(restServer: Express): void;
|
|
65
65
|
getInfoData(): any;
|
|
66
66
|
protected saveSwapData(swap: SpvVaultSwap): Promise<void>;
|
|
67
|
-
protected removeSwapData(hash: string, sequence: bigint): Promise<void>;
|
|
68
67
|
protected removeSwapData(swap: SpvVaultSwap, ultimateState?: SpvVaultSwapState): Promise<void>;
|
|
69
68
|
}
|
|
@@ -518,22 +518,10 @@ class SpvVaultSwapHandler extends SwapHandler_1.SwapHandler {
|
|
|
518
518
|
this.btcTxIdIndex.set(swap.btcTxId, swap);
|
|
519
519
|
return super.saveSwapData(swap);
|
|
520
520
|
}
|
|
521
|
-
async removeSwapData(
|
|
522
|
-
let swap;
|
|
523
|
-
let state;
|
|
524
|
-
if (typeof (hashOrSwap) === "string") {
|
|
525
|
-
if (typeof (sequenceOrUltimateState) !== "bigint")
|
|
526
|
-
throw new Error("Sequence must be a BN instance!");
|
|
527
|
-
swap = await this.storageManager.getData(hashOrSwap, sequenceOrUltimateState);
|
|
528
|
-
}
|
|
529
|
-
else {
|
|
530
|
-
swap = hashOrSwap;
|
|
531
|
-
if (sequenceOrUltimateState != null && typeof (sequenceOrUltimateState) !== "bigint")
|
|
532
|
-
state = sequenceOrUltimateState;
|
|
533
|
-
}
|
|
521
|
+
async removeSwapData(swap, ultimateState) {
|
|
534
522
|
if (swap.btcTxId != null)
|
|
535
523
|
this.btcTxIdIndex.delete(swap.btcTxId);
|
|
536
|
-
return super.removeSwapData(swap,
|
|
524
|
+
return super.removeSwapData(swap, ultimateState);
|
|
537
525
|
}
|
|
538
526
|
}
|
|
539
527
|
exports.SpvVaultSwapHandler = SpvVaultSwapHandler;
|
package/package.json
CHANGED
|
@@ -89,8 +89,9 @@ export abstract class EscrowHandler<V extends EscrowHandlerSwap<SwapData, S>, S>
|
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
-
protected removeSwapData(swap: V, ultimateState?: S): Promise<void>;
|
|
93
92
|
protected async removeSwapData(swap: V, ultimateState?: S) {
|
|
93
|
+
this.inflightSwaps.delete(swap.getIdentifier());
|
|
94
|
+
this.logger.debug("removeSwapData(): Removing in-flight swap, current in-flight swaps: "+this.inflightSwaps.size);
|
|
94
95
|
if(ultimateState!=null) await swap.setState(ultimateState);
|
|
95
96
|
if(swap!=null) await PluginManager.swapRemove(swap);
|
|
96
97
|
this.swapLogger.debug(swap, "removeSwapData(): removing swap final state: "+swap.state);
|
|
@@ -667,20 +667,9 @@ export class SpvVaultSwapHandler extends SwapHandler<SpvVaultSwap, SpvVaultSwapS
|
|
|
667
667
|
return super.saveSwapData(swap);
|
|
668
668
|
}
|
|
669
669
|
|
|
670
|
-
protected removeSwapData(
|
|
671
|
-
protected removeSwapData(swap: SpvVaultSwap, ultimateState?: SpvVaultSwapState): Promise<void>;
|
|
672
|
-
protected async removeSwapData(hashOrSwap: string | SpvVaultSwap, sequenceOrUltimateState?: bigint | SpvVaultSwapState): Promise<void> {
|
|
673
|
-
let swap: SpvVaultSwap;
|
|
674
|
-
let state: SpvVaultSwapState;
|
|
675
|
-
if(typeof(hashOrSwap)==="string") {
|
|
676
|
-
if(typeof(sequenceOrUltimateState)!=="bigint") throw new Error("Sequence must be a BN instance!");
|
|
677
|
-
swap = await this.storageManager.getData(hashOrSwap, sequenceOrUltimateState);
|
|
678
|
-
} else {
|
|
679
|
-
swap = hashOrSwap;
|
|
680
|
-
if(sequenceOrUltimateState!=null && typeof(sequenceOrUltimateState)!=="bigint") state = sequenceOrUltimateState;
|
|
681
|
-
}
|
|
670
|
+
protected async removeSwapData(swap: SpvVaultSwap, ultimateState?: SpvVaultSwapState): Promise<void> {
|
|
682
671
|
if(swap.btcTxId!=null) this.btcTxIdIndex.delete(swap.btcTxId);
|
|
683
|
-
return super.removeSwapData(swap,
|
|
672
|
+
return super.removeSwapData(swap, ultimateState);
|
|
684
673
|
}
|
|
685
674
|
|
|
686
675
|
}
|