@atomiqlabs/lp-lib 17.0.3 → 17.0.4

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.
@@ -511,9 +511,9 @@ class SpvVaults {
511
511
  const btcTxOutput = btcTx.outs[parseInt(voutStr)];
512
512
  const vaultAddress = this.bitcoin.fromOutputScript(Buffer.from(btcTxOutput.scriptPubKey.hex, "hex"));
513
513
  const vault = new SpvVault_1.SpvVault(chainId, vaultData, vaultAddress);
514
- vault.state = SpvVault_1.SpvVaultState.OPENED;
514
+ vault.state = vaultData.isOpened() ? SpvVault_1.SpvVaultState.OPENED : SpvVault_1.SpvVaultState.CLOSED;
515
515
  recoveredVaults.push(vault);
516
- if (await this.bitcoinRpc.isSpent(vaultData.getUtxo())) {
516
+ if (vaultData.isOpened() && await this.bitcoinRpc.isSpent(vaultData.getUtxo())) {
517
517
  if (!this.bitcoin.isReady())
518
518
  throw new Error("Bitcoin wallet is not ready, but is required to check wallet transactions!");
519
519
  //The latest smart chain UTXO is spent, we need to check if we have some further transactions
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atomiqlabs/lp-lib",
3
- "version": "17.0.3",
3
+ "version": "17.0.4",
4
4
  "description": "Main functionality implementation for atomiq LP node",
5
5
  "main": "./dist/index.js",
6
6
  "types:": "./dist/index.d.ts",
@@ -1,6 +1,8 @@
1
1
  import {SpvVault, SpvVaultState} from "./SpvVault";
2
2
  import {
3
- BitcoinRpc, BtcBlock, BtcTx,
3
+ BitcoinRpc,
4
+ BtcBlock,
5
+ BtcTx,
4
6
  IStorageManager,
5
7
  SpvVaultClaimEvent,
6
8
  SpvVaultCloseEvent,
@@ -591,9 +593,9 @@ export class SpvVaults {
591
593
  const btcTxOutput = btcTx.outs[parseInt(voutStr)];
592
594
  const vaultAddress = this.bitcoin.fromOutputScript(Buffer.from(btcTxOutput.scriptPubKey.hex, "hex"));
593
595
  const vault = new SpvVault(chainId, vaultData, vaultAddress);
594
- vault.state = SpvVaultState.OPENED;
596
+ vault.state = vaultData.isOpened() ? SpvVaultState.OPENED : SpvVaultState.CLOSED;
595
597
  recoveredVaults.push(vault);
596
- if(await this.bitcoinRpc.isSpent(vaultData.getUtxo())) {
598
+ if(vaultData.isOpened() && await this.bitcoinRpc.isSpent(vaultData.getUtxo())) {
597
599
  if(!this.bitcoin.isReady())
598
600
  throw new Error("Bitcoin wallet is not ready, but is required to check wallet transactions!");
599
601