From f1a5ae70e2eb1cea22c3ec8ebe5ae5ce5b04d937 Mon Sep 17 00:00:00 2001 From: Chris Troutner Date: Sun, 2 Oct 2022 15:43:16 -0700 Subject: [PATCH 1/6] fix(docker): Updating docker image --- production/docker/docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/production/docker/docker-compose.yml b/production/docker/docker-compose.yml index 936c81a..3d9e115 100644 --- a/production/docker/docker-compose.yml +++ b/production/docker/docker-compose.yml @@ -73,7 +73,7 @@ services: #build: # context: ./bch-dex/ # dockerfile: Dockerfile - image: christroutner/bch-dex:v2.0.6 + image: christroutner/bch-dex:v2.0.8 container_name: bch-dex environment: CONSUMER_URL: 'https://free-bch.fullstack.cash' From 8b75ac0f324e1259ce1c5a1ca3f987d3d939f20d Mon Sep 17 00:00:00 2001 From: Chris Troutner Date: Sun, 2 Oct 2022 16:50:54 -0700 Subject: [PATCH 2/6] Removing old comments --- src/adapters/wallet.js | 1 + src/use-cases/offer/index.js | 20 -------------------- 2 files changed, 1 insertion(+), 20 deletions(-) diff --git a/src/adapters/wallet.js b/src/adapters/wallet.js index dcf075b..e22b776 100644 --- a/src/adapters/wallet.js +++ b/src/adapters/wallet.js @@ -88,6 +88,7 @@ class WalletAdapter { } const advancedConfig = {} + console.log(`Using FullStack.cash: ${this.config.useFullStackCash}`) if (this.config.useFullStackCash) { advancedConfig.interface = 'rest-api' advancedConfig.restURL = this.config.apiServer diff --git a/src/use-cases/offer/index.js b/src/use-cases/offer/index.js index 77b2453..1d9887b 100644 --- a/src/use-cases/offer/index.js +++ b/src/use-cases/offer/index.js @@ -77,13 +77,6 @@ class OfferUseCases { // Verify that UTXO in offer is unspent. If it is spent, then ignore the // offer. - // const txid = offerObj.data.utxoTxid - // const vout = offerObj.data.utxoVout - // const utxoStatus = await this.adapters.bchjs.Blockchain.getTxOut( - // txid, - // vout - // ) - // const utxo = { tx_hash: offerObj.data.utxoTxid, tx_pos: offerObj.data.utxoVout @@ -292,18 +285,11 @@ class OfferUseCases { } // Verify that UTXO for sale is unspent. Abort if it's been spent. - // const txid = offerInfo.utxoTxid - // const vout = offerInfo.utxoVout - const utxo = { tx_hash: offerInfo.utxoTxid, tx_pos: offerInfo.utxoVout } const utxoStatus = await this.adapters.wallet.bchWallet.utxoIsValid(utxo) - // const utxoStatus = await this.adapters.bchjs.Blockchain.getTxOut( - // txid, - // vout - // ) console.log('utxoStatus: ', utxoStatus) if (!utxoStatus) { console.log(`utxo txid: ${offerInfo.utxoTxid}, vout: ${offerInfo.utxoVout}`) @@ -569,12 +555,6 @@ class OfferUseCases { let utxoStatus = null try { - // Get the status of the UTXO associate with this Offer. - // utxoStatus = await this.adapters.bchjs.Blockchain.getTxOut( - // thisOffer.utxoTxid, - // thisOffer.utxoVout - // ) - // Get the status of the UTXO associate with this Offer. const utxo = { tx_hash: thisOffer.utxoTxid, From 455fd807a490069e183490d18da71a5d99745029 Mon Sep 17 00:00:00 2001 From: Chris Troutner Date: Mon, 3 Oct 2022 05:58:33 -0700 Subject: [PATCH 3/6] fix(docker): Updating dex-ui docker image --- production/docker/docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/production/docker/docker-compose.yml b/production/docker/docker-compose.yml index 3d9e115..7001051 100644 --- a/production/docker/docker-compose.yml +++ b/production/docker/docker-compose.yml @@ -97,7 +97,7 @@ services: #build: # context: ./bch-dex-ui/ # dockerfile: Dockerfile - image: christroutner/bch-dex-ui:v1.12.0 + image: christroutner/bch-dex-ui:v1.2.4 container_name: dex-ui environment: SERVER: 'http://192.168.2.3' From 1e75816125cbb2288e0233cd887492dcb11b7b00 Mon Sep 17 00:00:00 2001 From: Chris Troutner Date: Mon, 3 Oct 2022 06:45:39 -0700 Subject: [PATCH 4/6] fix(RPi): Updating dex-ui docker image --- production/rpi-docker/docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/production/rpi-docker/docker-compose.yml b/production/rpi-docker/docker-compose.yml index 2b3ed3a..396c495 100644 --- a/production/rpi-docker/docker-compose.yml +++ b/production/rpi-docker/docker-compose.yml @@ -95,7 +95,7 @@ services: #build: # context: ./bch-dex-ui/ # dockerfile: Dockerfile - image: christroutner/bch-dex-ui-rpi:v1.2.2 + image: christroutner/bch-dex-ui-rpi:v1.2.4 container_name: dex-ui logging: driver: 'json-file' From 5b545aebebdb059eb0088c61ed5124e8a0e157c9 Mon Sep 17 00:00:00 2001 From: Chris Troutner Date: Mon, 3 Oct 2022 06:46:49 -0700 Subject: [PATCH 5/6] Updating RPi docker image --- production/rpi-docker/docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/production/rpi-docker/docker-compose.yml b/production/rpi-docker/docker-compose.yml index 396c495..14bc598 100644 --- a/production/rpi-docker/docker-compose.yml +++ b/production/rpi-docker/docker-compose.yml @@ -70,7 +70,7 @@ services: #build: # context: ./bch-dex/ # dockerfile: Dockerfile - image: christroutner/bch-dex-rpi:v2.0.6 + image: christroutner/bch-dex-rpi:v2.0.8 container_name: bch-dex environment: #CONSUMER_URL: 'https://free-bch.fullstack.cash' From 2047673862fb54107d5aebd0331c64c1bf261ce6 Mon Sep 17 00:00:00 2001 From: Chris Troutner Date: Wed, 5 Oct 2022 14:50:53 -0700 Subject: [PATCH 6/6] fix(timer controllers): Wrapper stale order/offer detection in retry-queue --- package-lock.json | 19 +++++++++---------- package.json | 7 +++---- src/use-cases/offer/index.js | 4 ++-- src/use-cases/order.js | 3 ++- 4 files changed, 16 insertions(+), 17 deletions(-) diff --git a/package-lock.json b/package-lock.json index b4d478d..6b00cf2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,8 +9,7 @@ "version": "2.0.2", "license": "MIT", "dependencies": { - "@chris.troutner/retry-queue": "1.0.5", - "@psf/bch-js": "^6.4.5", + "@chris.troutner/retry-queue": "1.0.8", "axios": "0.27.2", "bch-message-lib": "2.2.1", "bcryptjs": "2.4.3", @@ -32,7 +31,7 @@ "koa-router": "10.0.0", "koa-static": "5.0.0", "koa2-ratelimit": "0.9.1", - "libp2p": "^0.36.2", + "libp2p": "0.36.2", "line-reader": "0.4.0", "minimal-slp-wallet": "5.2.1", "mongoose": "5.13.14", @@ -40,7 +39,7 @@ "nodemailer": "6.7.5", "p2wdb": "2.2.3", "passport-local": "1.0.0", - "public-ip": "^4.0.4", + "public-ip": "4.0.4", "winston": "3.3.3", "winston-daily-rotate-file": "4.5.0" }, @@ -173,9 +172,9 @@ } }, "node_modules/@chris.troutner/retry-queue": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/@chris.troutner/retry-queue/-/retry-queue-1.0.5.tgz", - "integrity": "sha512-autE5GRCXR0xgPqq6qIq1sbUw8j2btxCWlezSvpRJmPVQQZwGhYbeF7euxRbpMmi31kj47iHgG7sb45bD0HY7Q==", + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/@chris.troutner/retry-queue/-/retry-queue-1.0.8.tgz", + "integrity": "sha512-ucyUGWTeXhOcXLglwb8alR3dNATPy+3vGea2uQJ0J8jnJufWrUr/NEq4b53op1tOTF029qrun6OmIN6Ls58pqw==", "dependencies": { "p-queue": "7.3.0", "p-retry": "5.1.1" @@ -15753,9 +15752,9 @@ } }, "@chris.troutner/retry-queue": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/@chris.troutner/retry-queue/-/retry-queue-1.0.5.tgz", - "integrity": "sha512-autE5GRCXR0xgPqq6qIq1sbUw8j2btxCWlezSvpRJmPVQQZwGhYbeF7euxRbpMmi31kj47iHgG7sb45bD0HY7Q==", + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/@chris.troutner/retry-queue/-/retry-queue-1.0.8.tgz", + "integrity": "sha512-ucyUGWTeXhOcXLglwb8alR3dNATPy+3vGea2uQJ0J8jnJufWrUr/NEq4b53op1tOTF029qrun6OmIN6Ls58pqw==", "requires": { "p-queue": "7.3.0", "p-retry": "5.1.1" diff --git a/package.json b/package.json index 729eddc..4a8f233 100644 --- a/package.json +++ b/package.json @@ -28,8 +28,7 @@ }, "repository": "Permissionless-Software-Foundation/bch-dex", "dependencies": { - "@chris.troutner/retry-queue": "1.0.5", - "@psf/bch-js": "^6.4.5", + "@chris.troutner/retry-queue": "1.0.8", "axios": "0.27.2", "bch-message-lib": "2.2.1", "bcryptjs": "2.4.3", @@ -51,7 +50,7 @@ "koa-router": "10.0.0", "koa-static": "5.0.0", "koa2-ratelimit": "0.9.1", - "libp2p": "^0.36.2", + "libp2p": "0.36.2", "line-reader": "0.4.0", "minimal-slp-wallet": "5.2.1", "mongoose": "5.13.14", @@ -59,7 +58,7 @@ "nodemailer": "6.7.5", "p2wdb": "2.2.3", "passport-local": "1.0.0", - "public-ip": "^4.0.4", + "public-ip": "4.0.4", "winston": "3.3.3", "winston-daily-rotate-file": "4.5.0" }, diff --git a/src/use-cases/offer/index.js b/src/use-cases/offer/index.js index 1d9887b..9421232 100644 --- a/src/use-cases/offer/index.js +++ b/src/use-cases/offer/index.js @@ -83,7 +83,6 @@ class OfferUseCases { } // const utxoStatus = await this.adapters.wallet.bchWallet.utxoIsValid(utxo) const utxoStatus = await this.retryQueue.addToQueue(this.adapters.wallet.bchWallet.utxoIsValid, utxo) - console.log('utxoStatus: ', utxoStatus) // if (utxoStatus === null) return false if (!utxoStatus) return false @@ -562,7 +561,8 @@ class OfferUseCases { } // console.log(`Checking this UTXO: ${JSON.stringify(utxo, null, 2)}`) - utxoStatus = await this.adapters.wallet.bchWallet.utxoIsValid(utxo) + // utxoStatus = await this.adapters.wallet.bchWallet.utxoIsValid(utxo) + utxoStatus = await this.retryQueue.addToQueue(this.adapters.wallet.bchWallet.utxoIsValid, utxo) // console.log('utxoStatus: ', utxoStatus) } catch (err) { // Handle corner case of bad-data in the Offer model. diff --git a/src/use-cases/order.js b/src/use-cases/order.js index d671c24..3dc7701 100644 --- a/src/use-cases/order.js +++ b/src/use-cases/order.js @@ -216,7 +216,8 @@ class OrderLib { tx_hash: thisOrder.utxoTxid, tx_pos: thisOrder.utxoVout } - utxoStatus = await this.adapters.wallet.bchWallet.utxoIsValid(utxo) + // utxoStatus = await this.adapters.wallet.bchWallet.utxoIsValid(utxo) + utxoStatus = await this.retryQueue.addToQueue(this.adapters.wallet.bchWallet.utxoIsValid, utxo) // console.log('utxoStatus: ', utxoStatus) } catch (err) { // Handle corner case of bad-data in the Order model.