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:
parent
1a3c3be665
commit
bd5c4e73e7
@ -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,7 +115,10 @@ public abstract class AbstractBlockChain {
|
||||
final boolean filtered = filteredTxHashes != null && filteredTxn != null;
|
||||
Preconditions.checkArgument((block.transactions == null && filtered)
|
||||
|| (block.transactions != null && !filtered));
|
||||
this.block = block;
|
||||
if (!shouldVerifyTransactions())
|
||||
this.block = block.cloneAsHeader();
|
||||
else
|
||||
this.block = block;
|
||||
this.filteredTxHashes = filteredTxHashes;
|
||||
this.filteredTxn = filteredTxn;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user