From 01fafcf0660eb46f1f396724138626032c629b79 Mon Sep 17 00:00:00 2001 From: Chris Kleeschulte Date: Mon, 9 Oct 2017 17:23:10 -0400 Subject: [PATCH] Fixed regtest for reorg. --- regtest/reorg.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/regtest/reorg.js b/regtest/reorg.js index 64d6408..e6ce071 100644 --- a/regtest/reorg.js +++ b/regtest/reorg.js @@ -155,6 +155,10 @@ var TestBitcoind = function TestBitcoind() { var plusOneBlockHash = data.slice(-32).reverse().toString('hex'); if (plusOneBlockHash !== '0000000000000000000000000000000000000000000000000000000000000000') { var nextBlock = self.blocks.get(plusOneBlockHash); + if (!nextBlock) { + console.log('did not find next block!!!!'); + return; + } blockHash = bcoin.util.revHex(nextBlock.prevBlock); } else { blockHash = self.blocks.getLastIndex().rhash();