Address PR comments

This commit is contained in:
Elizabeth Engelman 2019-02-20 09:37:08 -06:00 committed by Ian Norden
parent 8fc2cab837
commit 22d78f23cd
3 changed files with 8 additions and 14 deletions

View File

@ -937,14 +937,8 @@ func (bc *BlockChain) WriteBlockWithoutState(block *types.Block, td *big.Int) (e
} }
func (bc *BlockChain) AddToStateDiffProcessedCollection(hash common.Hash) { func (bc *BlockChain) AddToStateDiffProcessedCollection(hash common.Hash) {
count, ok := bc.stateDiffsProcessed[hash] count := bc.stateDiffsProcessed[hash]
bc.stateDiffsProcessed[hash] = count + 1
if ok {
count++
bc.stateDiffsProcessed[hash] = count
} else {
bc.stateDiffsProcessed[hash] = 1
}
} }
// WriteBlockWithState writes the block and all associated state to the database. // WriteBlockWithState writes the block and all associated state to the database.

View File

@ -1816,11 +1816,11 @@ func TestProcessingStateDiffs(t *testing.T) {
defaultTrieDirtyCache := 256 defaultTrieDirtyCache := 256
defaultTrieTimeout := 60 * time.Minute defaultTrieTimeout := 60 * time.Minute
cacheConfig := &CacheConfig{ cacheConfig := &CacheConfig{
Disabled: false, Disabled: false,
TrieCleanLimit: defaultTrieCleanCache, TrieCleanLimit: defaultTrieCleanCache,
TrieDirtyLimit: defaultTrieDirtyCache, TrieDirtyLimit: defaultTrieDirtyCache,
TrieTimeLimit: defaultTrieTimeout, TrieTimeLimit: defaultTrieTimeout,
ProcessStateDiffs: true, ProcessingStateDiffs: true,
} }
db := ethdb.NewMemDatabase() db := ethdb.NewMemDatabase()
genesis := new(Genesis).MustCommit(db) genesis := new(Genesis).MustCommit(db)

View File

@ -171,7 +171,7 @@ func New(ctx *node.ServiceContext, config *Config) (*Ethereum, error) {
TrieDirtyLimit: config.TrieDirtyCache, TrieDirtyLimit: config.TrieDirtyCache,
TrieDirtyDisabled: config.NoPruning, TrieDirtyDisabled: config.NoPruning,
TrieTimeLimit: config.TrieTimeout, TrieTimeLimit: config.TrieTimeout,
ProcessStateDiffs: config.StateDiff, ProcessingStateDiffs: config.StateDiff,
} }
) )
eth.blockchain, err = core.NewBlockChain(chainDb, cacheConfig, chainConfig, eth.engine, vmConfig, eth.shouldPreserve) eth.blockchain, err = core.NewBlockChain(chainDb, cacheConfig, chainConfig, eth.engine, vmConfig, eth.shouldPreserve)