From 967449b0d5b012e0c7bab2a7e16dc89c94dd0b16 Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Thu, 1 Dec 2016 13:35:04 -0800 Subject: [PATCH] chaindb: minor. --- lib/blockchain/chaindb.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/blockchain/chaindb.js b/lib/blockchain/chaindb.js index 4b11390a..f5cafc8e 100644 --- a/lib/blockchain/chaindb.js +++ b/lib/blockchain/chaindb.js @@ -933,6 +933,9 @@ ChainDB.prototype.getFullBlock = co(function* getFullBlock(hash) { view = new CoinView(); undo = yield this.getUndoCoins(block.hash()); + if (undo.isEmpty()) + return block; + for (i = block.txs.length - 1; i > 0; i--) { tx = block.txs[i]; for (j = tx.inputs.length - 1; j >= 0; j--) { @@ -942,7 +945,7 @@ ChainDB.prototype.getFullBlock = co(function* getFullBlock(hash) { } // Undo coins should be empty. - assert(undo.items.length === 0, 'Undo coins data inconsistency.'); + assert(undo.isEmpty(), 'Undo coins data inconsistency.'); return block; }); @@ -1759,7 +1762,7 @@ ChainDB.prototype.disconnectBlock = co(function* disconnectBlock(block) { } // Undo coins should be empty. - assert(undo.items.length === 0, 'Undo coins data inconsistency.'); + assert(undo.isEmpty(), 'Undo coins data inconsistency.'); // Commit new coin state. this.saveView(view);