From 22d78f23cd5139a9744efcdb9739315cc1414c96 Mon Sep 17 00:00:00 2001 From: Elizabeth Engelman Date: Wed, 20 Feb 2019 09:37:08 -0600 Subject: [PATCH] Address PR comments --- core/blockchain.go | 10 ++-------- core/blockchain_test.go | 10 +++++----- eth/backend.go | 2 +- 3 files changed, 8 insertions(+), 14 deletions(-) diff --git a/core/blockchain.go b/core/blockchain.go index e1bb482ea..5eebed9f4 100644 --- a/core/blockchain.go +++ b/core/blockchain.go @@ -937,14 +937,8 @@ func (bc *BlockChain) WriteBlockWithoutState(block *types.Block, td *big.Int) (e } func (bc *BlockChain) AddToStateDiffProcessedCollection(hash common.Hash) { - count, ok := bc.stateDiffsProcessed[hash] - - if ok { - count++ - bc.stateDiffsProcessed[hash] = count - } else { - bc.stateDiffsProcessed[hash] = 1 - } + count := bc.stateDiffsProcessed[hash] + bc.stateDiffsProcessed[hash] = count + 1 } // WriteBlockWithState writes the block and all associated state to the database. diff --git a/core/blockchain_test.go b/core/blockchain_test.go index 5379da1a2..682bab8d9 100644 --- a/core/blockchain_test.go +++ b/core/blockchain_test.go @@ -1816,11 +1816,11 @@ func TestProcessingStateDiffs(t *testing.T) { defaultTrieDirtyCache := 256 defaultTrieTimeout := 60 * time.Minute cacheConfig := &CacheConfig{ - Disabled: false, - TrieCleanLimit: defaultTrieCleanCache, - TrieDirtyLimit: defaultTrieDirtyCache, - TrieTimeLimit: defaultTrieTimeout, - ProcessStateDiffs: true, + Disabled: false, + TrieCleanLimit: defaultTrieCleanCache, + TrieDirtyLimit: defaultTrieDirtyCache, + TrieTimeLimit: defaultTrieTimeout, + ProcessingStateDiffs: true, } db := ethdb.NewMemDatabase() genesis := new(Genesis).MustCommit(db) diff --git a/eth/backend.go b/eth/backend.go index a64d96347..130cb44ef 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -171,7 +171,7 @@ func New(ctx *node.ServiceContext, config *Config) (*Ethereum, error) { TrieDirtyLimit: config.TrieDirtyCache, TrieDirtyDisabled: config.NoPruning, TrieTimeLimit: config.TrieTimeout, - ProcessStateDiffs: config.StateDiff, + ProcessingStateDiffs: config.StateDiff, } ) eth.blockchain, err = core.NewBlockChain(chainDb, cacheConfig, chainConfig, eth.engine, vmConfig, eth.shouldPreserve)