From 5ea218b373a14b880895b99e00b8a7dffb265e9b Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Fri, 17 Nov 2017 00:49:02 -0800 Subject: [PATCH] bcoin: require bn.js directly. --- lib/blockchain/chainentry.js | 2 +- lib/mining/common.js | 2 +- lib/protocol/consensus.js | 2 +- lib/protocol/networks.js | 2 +- migrate/chaindb2to3.js | 2 +- migrate/ensure-tip-index.js | 2 +- package.json | 1 + test/consensus-test.js | 2 +- 8 files changed, 8 insertions(+), 7 deletions(-) diff --git a/lib/blockchain/chainentry.js b/lib/blockchain/chainentry.js index b2b24238..3d61e60e 100644 --- a/lib/blockchain/chainentry.js +++ b/lib/blockchain/chainentry.js @@ -9,7 +9,7 @@ const assert = require('assert'); const bio = require('bufio'); -const BN = require('bcrypto/lib/bn'); +const BN = require('bn.js'); const consensus = require('../protocol/consensus'); const hash256 = require('bcrypto/lib/hash256'); const util = require('../utils/util'); diff --git a/lib/mining/common.js b/lib/mining/common.js index 9bb7c6d4..00f39e75 100644 --- a/lib/mining/common.js +++ b/lib/mining/common.js @@ -8,7 +8,7 @@ const assert = require('assert'); const consensus = require('../protocol/consensus'); -const BN = require('bcrypto/lib/bn'); +const BN = require('bn.js'); /** * @exports mining/common diff --git a/lib/protocol/consensus.js b/lib/protocol/consensus.js index 91d10b98..e61182f9 100644 --- a/lib/protocol/consensus.js +++ b/lib/protocol/consensus.js @@ -12,7 +12,7 @@ */ const assert = require('assert'); -const BN = require('bcrypto/lib/bn'); +const BN = require('bn.js'); /** * One bitcoin in satoshis. diff --git a/lib/protocol/networks.js b/lib/protocol/networks.js index c6e4c75a..c0a6889f 100644 --- a/lib/protocol/networks.js +++ b/lib/protocol/networks.js @@ -11,7 +11,7 @@ * @module protocol/networks */ -const BN = require('bcrypto/lib/bn'); +const BN = require('bn.js'); const network = exports; diff --git a/migrate/chaindb2to3.js b/migrate/chaindb2to3.js index 2ae30d54..6dbc87d0 100644 --- a/migrate/chaindb2to3.js +++ b/migrate/chaindb2to3.js @@ -18,7 +18,7 @@ if (process.argv.indexOf('-h') !== -1 const assert = require('assert'); const BDB = require('bdb'); const hash256 = require('bcrypto/lib/hash256'); -const BN = require('bcrypto/lib/bn'); +const BN = require('bn.js'); const bio = require('bufio'); const util = require('../lib/utils/util'); const OldCoins = require('./coins/coins'); diff --git a/migrate/ensure-tip-index.js b/migrate/ensure-tip-index.js index 7d16a2a1..84aa5ff2 100644 --- a/migrate/ensure-tip-index.js +++ b/migrate/ensure-tip-index.js @@ -4,7 +4,7 @@ const assert = require('assert'); const BDB = require('bdb'); const bio = require('bufio'); const hash256 = require('bcrypto/lib/hash256'); -const BN = require('bcrypto/lib/bn'); +const BN = require('bn.js'); const util = require('../lib/utils/util'); const {encoding} = bio; diff --git a/package.json b/package.json index fc52cafa..8b4f0a06 100644 --- a/package.json +++ b/package.json @@ -34,6 +34,7 @@ "binet": "^0.0.1", "blgr": "^0.0.1", "bmutex": "^0.0.1", + "bn.js": "^4.11.8", "brq": "^0.0.1", "bsock": "^0.0.1", "bsocks": "^0.0.1", diff --git a/test/consensus-test.js b/test/consensus-test.js index 33882b42..5cde951e 100644 --- a/test/consensus-test.js +++ b/test/consensus-test.js @@ -5,7 +5,7 @@ const assert = require('./util/assert'); const consensus = require('../lib/protocol/consensus'); -const BN = require('bcrypto/lib/bn'); +const BN = require('bn.js'); describe('Consensus', function() { it('should calculate reward properly', () => {