chain/util: minor style change.
This commit is contained in:
parent
4150623eb0
commit
4c18dc5d0e
@ -1603,13 +1603,12 @@ Chain.prototype.verifyCheckpoint = function verifyCheckpoint(prev, hash) {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
Chain.prototype.storeOrphan = function storeOrphan(block, flags, id) {
|
Chain.prototype.storeOrphan = function storeOrphan(block, flags, id) {
|
||||||
const hash = block.hash('hex');
|
|
||||||
const height = block.getCoinbaseHeight();
|
const height = block.getCoinbaseHeight();
|
||||||
let orphan = this.orphanPrev.get(block.prevBlock);
|
const orphan = this.orphanPrev.get(block.prevBlock);
|
||||||
|
|
||||||
// The orphan chain forked.
|
// The orphan chain forked.
|
||||||
if (orphan) {
|
if (orphan) {
|
||||||
assert(orphan.block.hash('hex') !== hash);
|
assert(orphan.block.hash('hex') !== block.hash('hex'));
|
||||||
assert(orphan.block.prevBlock === block.prevBlock);
|
assert(orphan.block.prevBlock === block.prevBlock);
|
||||||
|
|
||||||
this.logger.warning(
|
this.logger.warning(
|
||||||
@ -1620,10 +1619,7 @@ Chain.prototype.storeOrphan = function storeOrphan(block, flags, id) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.limitOrphans();
|
this.limitOrphans();
|
||||||
|
this.addOrphan(new Orphan(block, flags, id));
|
||||||
orphan = new Orphan(block, flags, id);
|
|
||||||
|
|
||||||
this.addOrphan(orphan);
|
|
||||||
|
|
||||||
this.logger.debug(
|
this.logger.debug(
|
||||||
'Storing orphan block: %s (%d).',
|
'Storing orphan block: %s (%d).',
|
||||||
|
|||||||
@ -850,10 +850,12 @@ util.toFixed = function toFixed(num, exp) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const mult = pow10(exp);
|
const mult = pow10(exp);
|
||||||
|
|
||||||
let lo = num % mult;
|
let lo = num % mult;
|
||||||
const hi = (num - lo) / mult;
|
let hi = (num - lo) / mult;
|
||||||
|
|
||||||
lo = lo.toString(10);
|
lo = lo.toString(10);
|
||||||
|
hi = hi.toString(10);
|
||||||
|
|
||||||
while (lo.length < exp)
|
while (lo.length < exp)
|
||||||
lo = '0' + lo;
|
lo = '0' + lo;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user