AbstractBlockChain: Try connecting orphans more often in add().
This fixes a memory leak.
@@ -461,18 +461,18 @@ public abstract class AbstractBlockChain {
checkState(tryConnecting, "bug in tryConnectingOrphans");
log.warn("Block does not connect: {} prev {}", block.getHashAsString(), block.getPrevBlockHash());
orphanBlocks.put(block.getHash(), new OrphanBlock(block, filteredTxHashList, filteredTxn));
+ if (tryConnecting)
+ tryConnectingOrphans();
return false;
} else {
checkState(lock.isHeldByCurrentThread());
// It connects to somewhere on the chain. Not necessarily the top of the best known chain.
params.checkDifficultyTransitions(storedPrev, block, blockStore);
connectBlock(block, storedPrev, shouldVerifyTransactions(), filteredTxHashList, filteredTxn);
- }
-
if (tryConnecting)
tryConnectingOrphans();
-
return true;
+ }
} finally {
lock.unlock();
}
