3
0
mirror of https://github.com/Qortal/altcoinj.git synced 2025-01-31 15:22:16 +00:00

Prevent memory blowup on orphan storage

This commit is contained in:
Matt Corallo 2014-01-22 22:57:08 -05:00 committed by Mike Hearn
parent 1a3c3be665
commit bd5c4e73e7

View File

@ -107,7 +107,7 @@ public abstract class AbstractBlockChain {
private final CopyOnWriteArrayList<ListenerRegistration<BlockChainListener>> listeners;
// Holds a block header and, optionally, a list of tx hashes or block's transactions
static class OrphanBlock {
class OrphanBlock {
final Block block;
final List<Sha256Hash> filteredTxHashes;
final Map<Sha256Hash, Transaction> filteredTxn;
@ -115,6 +115,9 @@ public abstract class AbstractBlockChain {
final boolean filtered = filteredTxHashes != null && filteredTxn != null;
Preconditions.checkArgument((block.transactions == null && filtered)
|| (block.transactions != null && !filtered));
if (!shouldVerifyTransactions())
this.block = block.cloneAsHeader();
else
this.block = block;
this.filteredTxHashes = filteredTxHashes;
this.filteredTxn = filteredTxn;