diff --git a/lib/bcoin/chainblock.js b/lib/bcoin/chainblock.js index 9c4c741d..8595ec87 100644 --- a/lib/bcoin/chainblock.js +++ b/lib/bcoin/chainblock.js @@ -58,7 +58,7 @@ ChainBlock.prototype.getChainwork = function getChainwork() { // Workaround for genesis block // being added _in_ chaindb. if (!this.chain.db) - return; + return this.getProof(); prev = this.prev; diff --git a/lib/bcoin/chaindb.js b/lib/bcoin/chaindb.js index 098f9a9b..11f9f730 100644 --- a/lib/bcoin/chaindb.js +++ b/lib/bcoin/chaindb.js @@ -359,7 +359,8 @@ ChainDB.prototype.saveSync = function saveSync(entry) { assert(entry.height >= 0); if (entry.height * BLOCK_SIZE !== this.size) { - utils.debug('Warning attempt to write to height: %d/%d', this.height); + utils.debug('Warning attempt to write to height: %d/%d', + entry.height, this.getSize() - 1); return false; } @@ -385,7 +386,8 @@ ChainDB.prototype.saveAsync = function saveAsync(entry, callback) { assert(entry.height >= 0); if (entry.height * BLOCK_SIZE !== this.size) { - utils.debug('Warning attempt to write to height: %d/%d', this.height); + utils.debug('Warning attempt to write to height: %d/%d', + entry.height, this.getSize() - 1); return callback(); }