diff --git a/.circleci/config.yml b/.circleci/config.yml index 2966d7017a..5a8df94cc6 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -64,7 +64,6 @@ jobs: - ./packages/core-vote-report/node_modules - ./packages/core-webhooks/node_modules - ./packages/crypto/node_modules - - ./packages/utils/node_modules - ./node_modules - run: name: Create .ark/database directory @@ -78,8 +77,8 @@ jobs: ./packages/core-json-rpc/ ./packages/core-http-utils/ ./packages/core-event-emitter/ ./packages/core-elasticsearch/ ./packages/core-database-postgres/ ./packages/core-config/ - ./packages/core-interfaces/ --detectOpenHandles --runInBand - --forceExit --ci --coverage | tee test_output.txt + ./packages/core/ --detectOpenHandles --runInBand --forceExit --ci + --coverage | tee test_output.txt - run: name: Last 1000 lines of test output when: on_fail @@ -151,7 +150,6 @@ jobs: - ./packages/core-vote-report/node_modules - ./packages/core-webhooks/node_modules - ./packages/crypto/node_modules - - ./packages/utils/node_modules - ./node_modules - run: name: Create .ark/database directory @@ -162,10 +160,11 @@ jobs: ./node_modules/.bin/cross-env ARK_ENV=test ./node_modules/.bin/jest ./packages/crypto/ ./packages/core-utils/ ./packages/core-tester-cli/ ./packages/core-snapshots/ - ./packages/core-logger/ ./packages/core-api/ ./packages/core-forger/ - ./packages/core-error-tracker-bugsnag/ ./packages/core-debugger-cli/ - ./packages/core-container/ ./packages/core/ --detectOpenHandles - --runInBand --forceExit --ci --coverage | tee test_output.txt + ./packages/core-logger/ ./packages/core-interfaces/ + ./packages/core-forger/ ./packages/core-error-tracker-bugsnag/ + ./packages/core-debugger-cli/ ./packages/core-container/ + ./packages/core-api/ --detectOpenHandles --runInBand --forceExit + --ci --coverage | tee test_output.txt - run: name: Last 1000 lines of test output when: on_fail @@ -237,7 +236,6 @@ jobs: - ./packages/core-vote-report/node_modules - ./packages/core-webhooks/node_modules - ./packages/crypto/node_modules - - ./packages/utils/node_modules - ./node_modules - run: name: Create .ark/database directory @@ -246,13 +244,13 @@ jobs: name: Test command: > ./node_modules/.bin/cross-env ARK_ENV=test ./node_modules/.bin/jest - ./packages/utils/ ./packages/core-vote-report/ - ./packages/core-transaction-pool/ ./packages/core-snapshots-cli/ - ./packages/core-logger-winston/ ./packages/core-jest-matchers/ - ./packages/core-graphql/ ./packages/core-error-tracker-sentry/ - ./packages/core-deployer/ ./packages/core-database/ - ./packages/core-blockchain/ --detectOpenHandles --runInBand - --forceExit --ci --coverage | tee test_output.txt + ./packages/core-vote-report/ ./packages/core-transaction-pool/ + ./packages/core-snapshots-cli/ ./packages/core-logger-winston/ + ./packages/core-jest-matchers/ ./packages/core-graphql/ + ./packages/core-error-tracker-sentry/ ./packages/core-deployer/ + ./packages/core-database/ ./packages/core-blockchain/ + --detectOpenHandles --runInBand --forceExit --ci --coverage | tee + test_output.txt - run: name: Last 1000 lines of test output when: on_fail diff --git a/packages/core-blockchain/lib/blockchain.js b/packages/core-blockchain/lib/blockchain.js index 4f824ef1e2..880e7916ae 100644 --- a/packages/core-blockchain/lib/blockchain.js +++ b/packages/core-blockchain/lib/blockchain.js @@ -512,6 +512,10 @@ module.exports = class Blockchain { logger.debug( `Block ${block.data.height.toLocaleString()} just received :chains:`, ) + } else if (block.data.timestamp < lastBlock.data.timestamp) { + logger.debug( + `Block ${block.data.height.toLocaleString()} disregarded because it has a lower timestamp than the last block :bangbang:` + ) } else { const isValid = await this.database.validateForkedBlock(block) diff --git a/packages/core-p2p/__tests__/utils/is-myself.test.js b/packages/core-p2p/__tests__/utils/is-myself.test.js index cc9e941dab..873aa9d8f9 100644 --- a/packages/core-p2p/__tests__/utils/is-myself.test.js +++ b/packages/core-p2p/__tests__/utils/is-myself.test.js @@ -12,6 +12,10 @@ describe('isMyself', () => { expect(isMyself('192.167.22.1')).toBeFalse() }) + it('should be ok for non-quad-dotted localhost addresses', () => { + expect(isMyself('2130706433')).toBeTrue() + }) + it('should be ok for LAN addresses', () => { const interfaces = os.networkInterfaces() const addresses = [] diff --git a/packages/core-p2p/lib/utils/is-myself.js b/packages/core-p2p/lib/utils/is-myself.js index c60d6c975b..45ca858fa4 100644 --- a/packages/core-p2p/lib/utils/is-myself.js +++ b/packages/core-p2p/lib/utils/is-myself.js @@ -1,6 +1,7 @@ /* eslint max-len: "off" */ const os = require('os') +const ip = require("ipaddr.js") /** * Checks if IP belongs to local computer (all network interfaces are checked) @@ -10,6 +11,12 @@ const os = require('os') module.exports = ipAddress => { const interfaces = os.networkInterfaces() + try { + ipAddress = ip.parse(ipAddress).toString(); + } catch (error) { + return true; + } + return ( ipAddress.startsWith('127.') || ipAddress.startsWith('0.') || diff --git a/packages/core/package.json b/packages/core/package.json index e5472986d6..4ae27796bd 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,7 +1,7 @@ { "name": "@arkecosystem/core", "description": "Core of the Ark Blockchain", - "version": "2.0.18", + "version": "2.0.19", "contributors": [ "François-Xavier Thoorens ", "Kristjan Košič ",