chaindb: minor.

This commit is contained in:
Christopher Jeffrey 2016-12-01 13:35:04 -08:00
parent 244af663bb
commit 967449b0d5
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD

View File

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