chain/util: minor style change.

This commit is contained in:
Christopher Jeffrey 2017-09-19 12:51:56 -07:00
parent 4150623eb0
commit 4c18dc5d0e
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD
2 changed files with 6 additions and 8 deletions

View File

@ -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).',

View File

@ -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;