From 4c18dc5d0ee8634eea02eaa2c6e634e35202be2c Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Tue, 19 Sep 2017 12:51:56 -0700 Subject: [PATCH] chain/util: minor style change. --- lib/blockchain/chain.js | 10 +++------- lib/utils/util.js | 4 +++- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/lib/blockchain/chain.js b/lib/blockchain/chain.js index a3887899..303f2c10 100644 --- a/lib/blockchain/chain.js +++ b/lib/blockchain/chain.js @@ -1603,13 +1603,12 @@ Chain.prototype.verifyCheckpoint = function verifyCheckpoint(prev, hash) { */ Chain.prototype.storeOrphan = function storeOrphan(block, flags, id) { - const hash = block.hash('hex'); const height = block.getCoinbaseHeight(); - let orphan = this.orphanPrev.get(block.prevBlock); + const orphan = this.orphanPrev.get(block.prevBlock); // The orphan chain forked. if (orphan) { - assert(orphan.block.hash('hex') !== hash); + assert(orphan.block.hash('hex') !== block.hash('hex')); assert(orphan.block.prevBlock === block.prevBlock); this.logger.warning( @@ -1620,10 +1619,7 @@ Chain.prototype.storeOrphan = function storeOrphan(block, flags, id) { } this.limitOrphans(); - - orphan = new Orphan(block, flags, id); - - this.addOrphan(orphan); + this.addOrphan(new Orphan(block, flags, id)); this.logger.debug( 'Storing orphan block: %s (%d).', diff --git a/lib/utils/util.js b/lib/utils/util.js index ffe898ef..f348c437 100644 --- a/lib/utils/util.js +++ b/lib/utils/util.js @@ -850,10 +850,12 @@ util.toFixed = function toFixed(num, exp) { } const mult = pow10(exp); + let lo = num % mult; - const hi = (num - lo) / mult; + let hi = (num - lo) / mult; lo = lo.toString(10); + hi = hi.toString(10); while (lo.length < exp) lo = '0' + lo;