From 16baecb0a9958e1acf92e88000701745be5e4226 Mon Sep 17 00:00:00 2001 From: Baptiste Boussemart Date: Mon, 30 Aug 2021 17:13:46 +0200 Subject: [PATCH] GoQ comments --- core/blockchain.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/core/blockchain.go b/core/blockchain.go index e6ba0db5e8..8bf19b05e0 100644 --- a/core/blockchain.go +++ b/core/blockchain.go @@ -1183,6 +1183,7 @@ func (bc *BlockChain) Stop() { if err := privateTrieDb.Commit(privateRoot, true, nil); err != nil { log.Error("Failed to commit recent private state trie", "err", err) } + // End Quorum } } if snapBase != (common.Hash{}) { @@ -1758,6 +1759,7 @@ func (bc *BlockChain) writeBlockWithState(block *types.Block, receipts []*types. privateTrieDB.Reference(privateRoot, common.Hash{}) // metadata reference to keep private trie alive bc.privateTrieGC.Push(privateRoot, -int64(block.NumberU64())) } + // End Quorum if current := block.NumberU64(); current > TriesInMemory { // If we exceeded our memory allowance, flush matured singleton nodes to disk @@ -1769,9 +1771,13 @@ func (bc *BlockChain) writeBlockWithState(block *types.Block, receipts []*types. if nodes > limit || imgs > 4*1024*1024 { triedb.Cap(limit - ethdb.IdealBatchSize) } + + // Quorum if privateNodes > limit || privateImgs > 4*1024*1024 { privateTrieDB.Cap(limit - ethdb.IdealBatchSize) } + // End Quorum + // Find the next state trie we need to commit chosen := current - TriesInMemory @@ -1790,8 +1796,12 @@ func (bc *BlockChain) writeBlockWithState(block *types.Block, receipts []*types. } // Flush an entire trie and restart the counters triedb.Commit(header.Root, true, nil) + + // Quorum privateroot := rawdb.GetPrivateStateRoot(bc.db, header.Root) privateTrieDB.Commit(privateroot, true, nil) + // End Quorum + lastWrite = chosen bc.gcproc = 0 }