diff --git a/core/src/test/java/org/bitcoinj/core/BitcoindComparisonTool.java b/core/src/test/java/org/bitcoinj/core/BitcoindComparisonTool.java index 352edf51..0538ab95 100644 --- a/core/src/test/java/org/bitcoinj/core/BitcoindComparisonTool.java +++ b/core/src/test/java/org/bitcoinj/core/BitcoindComparisonTool.java @@ -287,6 +287,8 @@ public class BitcoindComparisonTool { differingBlocks++; log.error("bitcoind and bitcoinj acceptance differs on block \"" + block.ruleName + "\""); } + if (block.sendOnce) + preloadedBlocks.remove(nextBlock.getHash()); log.info("Block \"" + block.ruleName + "\" completed processing"); } else if (rule instanceof MemoryPoolState) { MemoryPoolMessage message = new MemoryPoolMessage(); diff --git a/core/src/test/java/org/bitcoinj/core/FullBlockTestGenerator.java b/core/src/test/java/org/bitcoinj/core/FullBlockTestGenerator.java index f8e65552..ae9901e0 100644 --- a/core/src/test/java/org/bitcoinj/core/FullBlockTestGenerator.java +++ b/core/src/test/java/org/bitcoinj/core/FullBlockTestGenerator.java @@ -56,6 +56,7 @@ class BlockAndValidity extends Rule { Sha256Hash blockHash; boolean connects; boolean throwsException; + boolean sendOnce; // We can throw away the memory for this block once we send it the first time (if bitcoind asks again, its broken) Sha256Hash hashChainTipAfterBlock; int heightAfterBlock; @@ -81,6 +82,11 @@ class BlockAndValidity extends Rule { else blockToHeightMap.put(hashChainTipAfterBlock, heightAfterBlock); } + + public BlockAndValidity setSendOnce(boolean sendOnce) { + this.sendOnce = sendOnce; + return this; + } } /** @@ -1658,7 +1664,7 @@ public class FullBlockTestGenerator { } block.solve(); blocks.add(new BlockAndValidity(blockToHeightMap, hashHeaderMap, block, true, false, block.getHash(), nextHeight-1, - "post-b1001 repeated transaction generator " + blockCountAfter1001 + "/" + TRANSACTION_CREATION_BLOCKS)); + "post-b1001 repeated transaction generator " + blockCountAfter1001 + "/" + TRANSACTION_CREATION_BLOCKS).setSendOnce(true)); lastBlock = block; } @@ -1672,7 +1678,8 @@ public class FullBlockTestGenerator { block.addTransaction(tx); } block.solve(); - blocks.add(new BlockAndValidity(blockToHeightMap, hashHeaderMap, block, true, false, block.getHash(), nextHeight-1, "post-b1001 repeated transaction spender " + i)); + blocks.add(new BlockAndValidity(blockToHeightMap, hashHeaderMap, block, true, false, block.getHash(), nextHeight-1, + "post-b1001 repeated transaction spender " + i).setSendOnce(true)); lastBlock = block; blockCountAfter1001++; }