mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-02-07 23:03:04 +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;
|
private final CopyOnWriteArrayList<ListenerRegistration<BlockChainListener>> listeners;
|
||||||
|
|
||||||
// Holds a block header and, optionally, a list of tx hashes or block's transactions
|
// Holds a block header and, optionally, a list of tx hashes or block's transactions
|
||||||
static class OrphanBlock {
|
class OrphanBlock {
|
||||||
final Block block;
|
final Block block;
|
||||||
final List<Sha256Hash> filteredTxHashes;
|
final List<Sha256Hash> filteredTxHashes;
|
||||||
final Map<Sha256Hash, Transaction> filteredTxn;
|
final Map<Sha256Hash, Transaction> filteredTxn;
|
||||||
@ -115,7 +115,10 @@ public abstract class AbstractBlockChain {
|
|||||||
final boolean filtered = filteredTxHashes != null && filteredTxn != null;
|
final boolean filtered = filteredTxHashes != null && filteredTxn != null;
|
||||||
Preconditions.checkArgument((block.transactions == null && filtered)
|
Preconditions.checkArgument((block.transactions == null && filtered)
|
||||||
|| (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.filteredTxHashes = filteredTxHashes;
|
||||||
this.filteredTxn = filteredTxn;
|
this.filteredTxn = filteredTxn;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user