From 495dda79efcd0c90fa06ec5ae1f8b1ded0c57ab6 Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Thu, 21 Jan 2016 02:01:49 -0800 Subject: [PATCH] fix assert. --- lib/bcoin/chain.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/bcoin/chain.js b/lib/bcoin/chain.js index 38bcd569..4970f21f 100644 --- a/lib/bcoin/chain.js +++ b/lib/bcoin/chain.js @@ -735,6 +735,9 @@ ChainDB.prototype._init = function _init() { } this.size = this.getSize(); + + assert(this.size % BLOCK_SIZE === 0); + this.fd = fs.openSync(this.file, 'r+'); }; @@ -764,7 +767,7 @@ ChainDB.prototype.getSize = function getSize() { ChainDB.prototype.count = function count() { var len = this.size / BLOCK_SIZE; - assert(len === (len | 0)); + assert(len % 1 === 0); return len; };