mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-02-14 11:15:51 +00:00
Fix OOM issues introduced by recent changes.
This commit is contained in:
parent
2780b3f9b7
commit
1740ec6750
@ -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();
|
||||
|
@ -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++;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user