From d9761fbe163370b875c22de14c9c5d98628e95f8 Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Sat, 16 Apr 2016 20:07:02 -0700 Subject: [PATCH] fix loop. --- lib/bcoin/chaindb.js | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/lib/bcoin/chaindb.js b/lib/bcoin/chaindb.js index 8b10e366..8917df78 100644 --- a/lib/bcoin/chaindb.js +++ b/lib/bcoin/chaindb.js @@ -827,7 +827,7 @@ ChainDB.prototype.connectBlock = function connectBlock(block, batch, callback) { batch.del('u/t/' + key); } - for (j = 0; j < tx.inputs.length; j++) { + for (j = 0; j < tx.outputs.length; j++) { output = tx.outputs[j]; key = hash + '/' + j; @@ -874,11 +874,6 @@ ChainDB.prototype.disconnectBlock = function disconnectBlock(block, batch, callb if (!block) return callback(new Error('Block not found.')); - if (self.options.paranoid) { - if (typeof block === 'string') - assert(block.hash('hex') === block, 'Database is corrupt.'); - } - for (i = block.txs.length - 1; i >= 0; i--) { tx = block.txs[i]; hash = tx.hash('hex'); @@ -908,7 +903,7 @@ ChainDB.prototype.disconnectBlock = function disconnectBlock(block, batch, callb batch.put('u/t/' + key, input.coin.toRaw()); } - for (j = 0; j < tx.inputs.length; j++) { + for (j = 0; j < tx.outputs.length; j++) { output = tx.outputs[j]; key = hash + '/' + j;