From ffec8ff2d7e05591d113004ed1aca6e0c4fd1d20 Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Thu, 20 Jul 2017 17:22:59 -0700 Subject: [PATCH] chain: improve version display. fix getLocator. --- lib/blockchain/chain.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/blockchain/chain.js b/lib/blockchain/chain.js index d0fe2a65..5105e8de 100644 --- a/lib/blockchain/chain.js +++ b/lib/blockchain/chain.js @@ -923,7 +923,7 @@ Chain.prototype.setBestChain = async function setBestChain(entry, block, prev, f if (entry.hasUnknown()) { this.logger.warning( 'Unknown version bits in block %d: %d.', - entry.height, entry.version); + entry.height, util.hex32(entry.version)); } // Otherwise, everything is in order. @@ -1838,8 +1838,10 @@ Chain.prototype._getLocator = async function getLocator(start) { entry = await this.db.getEntry(start); - if (!entry) - throw new Error('Tip not found.'); + if (!entry) { + entry = this.tip; + hashes.push(start); + } hash = entry.hash; height = entry.height;