diff --git a/backend/src/api/fiat-conversion.ts b/backend/src/api/fiat-conversion.ts index f28f34a0b..5fdde7274 100644 --- a/backend/src/api/fiat-conversion.ts +++ b/backend/src/api/fiat-conversion.ts @@ -43,7 +43,7 @@ class FiatConversion { agentOptions: { keepAlive: true, }, - host: config.SOCKS5PROXY.HOST, + hostname: config.SOCKS5PROXY.HOST, port: config.SOCKS5PROXY.PORT }; diff --git a/backend/src/repositories/BlocksRepository.ts b/backend/src/repositories/BlocksRepository.ts index b1980c26c..47a18fc9b 100644 --- a/backend/src/repositories/BlocksRepository.ts +++ b/backend/src/repositories/BlocksRepository.ts @@ -426,18 +426,28 @@ class BlocksRepository { const [blocks]: any[] = await DB.query(`SELECT height, hash, previous_block_hash, UNIX_TIMESTAMP(blockTimestamp) as timestamp FROM blocks ORDER BY height`); - let currentHeight = 1; - while (currentHeight < blocks.length) { - if (blocks[currentHeight].previous_block_hash !== blocks[currentHeight - 1].hash) { - logger.warn(`Chain divergence detected at block ${blocks[currentHeight - 1].height}, re-indexing newer blocks and hashrates`); - await this.$deleteBlocksFrom(blocks[currentHeight - 1].height); - await HashratesRepository.$deleteHashratesFromTimestamp(blocks[currentHeight - 1].timestamp - 604800); + let partialMsg = false; + let idx = 1; + while (idx < blocks.length) { + if (blocks[idx].height - 1 !== blocks[idx - 1].height) { + if (partialMsg === false) { + logger.info('Some blocks are not indexed, skipping missing blocks during chain validation'); + partialMsg = true; + } + ++idx; + continue; + } + + if (blocks[idx].previous_block_hash !== blocks[idx - 1].hash) { + logger.warn(`Chain divergence detected at block ${blocks[idx - 1].height}, re-indexing newer blocks and hashrates`); + await this.$deleteBlocksFrom(blocks[idx - 1].height); + await HashratesRepository.$deleteHashratesFromTimestamp(blocks[idx - 1].timestamp - 604800); return false; } - ++currentHeight; + ++idx; } - logger.info(`${currentHeight} blocks hash validated in ${new Date().getTime() - start} ms`); + logger.info(`${idx} blocks hash validated in ${new Date().getTime() - start} ms`); return true; } catch (e) { logger.err('Cannot validate chain of block hash. Reason: ' + (e instanceof Error ? e.message : e)); diff --git a/backend/src/sync-assets.ts b/backend/src/sync-assets.ts index 032e71ee2..74d15e901 100644 --- a/backend/src/sync-assets.ts +++ b/backend/src/sync-assets.ts @@ -29,7 +29,7 @@ class SyncAssets { agentOptions: { keepAlive: true, }, - host: config.SOCKS5PROXY.HOST, + hostname: config.SOCKS5PROXY.HOST, port: config.SOCKS5PROXY.PORT }; diff --git a/docker/README.md b/docker/README.md index 07590d0dd..37a2cc079 100644 --- a/docker/README.md +++ b/docker/README.md @@ -155,7 +155,7 @@ Corresponding `docker-compose.yml` overrides: environment: ELECTRUM_HOST: "" ELECTRUM_PORT: "" - ELECTRUM_TLS: "" + ELECTRUM_TLS_ENABLED: "" ... ``` diff --git a/docker/backend/start.sh b/docker/backend/start.sh index 09672184d..960171e43 100644 --- a/docker/backend/start.sh +++ b/docker/backend/start.sh @@ -28,7 +28,7 @@ __CORE_RPC_PASSWORD__=${CORE_RPC_PASSWORD:=mempool} # ELECTRUM __ELECTRUM_HOST__=${ELECTRUM_HOST:=127.0.0.1} __ELECTRUM_PORT__=${ELECTRUM_PORT:=50002} -__ELECTRUM_TLS_ENABLED__=${ELECTRUM_TLS:=false} +__ELECTRUM_TLS_ENABLED__=${ELECTRUM_TLS_ENABLED:=false} # ESPLORA __ESPLORA_REST_API_URL__=${ESPLORA_REST_API_URL:=http://127.0.0.1:3000} diff --git a/frontend/src/app/components/blocks-list/blocks-list.component.html b/frontend/src/app/components/blocks-list/blocks-list.component.html index e31214443..a27d8fbeb 100644 --- a/frontend/src/app/components/blocks-list/blocks-list.component.html +++ b/frontend/src/app/components/blocks-list/blocks-list.component.html @@ -29,7 +29,7 @@