diff options
author | Jeffrey Wilcke <geffobscura@gmail.com> | 2015-07-17 21:43:16 +0800 |
---|---|---|
committer | Jeffrey Wilcke <geffobscura@gmail.com> | 2015-07-23 16:45:31 +0800 |
commit | 8fc983097150325063a2e7558e0e14b2a8acca34 (patch) | |
tree | b39d14a02b8d517ffbef2810c5af5f3a2277ac2c /core/chain_manager.go | |
parent | 0cff61bedaca42c94d162853cd55eb1e013dadb9 (diff) | |
download | dexon-8fc983097150325063a2e7558e0e14b2a8acca34.tar dexon-8fc983097150325063a2e7558e0e14b2a8acca34.tar.gz dexon-8fc983097150325063a2e7558e0e14b2a8acca34.tar.bz2 dexon-8fc983097150325063a2e7558e0e14b2a8acca34.tar.lz dexon-8fc983097150325063a2e7558e0e14b2a8acca34.tar.xz dexon-8fc983097150325063a2e7558e0e14b2a8acca34.tar.zst dexon-8fc983097150325063a2e7558e0e14b2a8acca34.zip |
cmd/core,xeth: removed unneeded states & added batch writes
Diffstat (limited to 'core/chain_manager.go')
-rw-r--r-- | core/chain_manager.go | 22 |
1 files changed, 0 insertions, 22 deletions
diff --git a/core/chain_manager.go b/core/chain_manager.go index b2fcb677c..0f008dfa7 100644 --- a/core/chain_manager.go +++ b/core/chain_manager.go @@ -73,9 +73,6 @@ type ChainManager struct { lastBlockHash common.Hash currentGasLimit *big.Int - transState *state.StateDB - txState *state.ManagedState - cache *lru.Cache // cache is the LRU caching futureBlocks *lru.Cache // future blocks are blocks added for later processing @@ -128,9 +125,7 @@ func NewChainManager(blockDb, stateDb, extraDb common.Database, pow pow.PoW, mux } } - bc.transState = bc.State().Copy() // Take ownership of this particular state - bc.txState = state.ManageState(bc.State().Copy()) bc.futureBlocks, _ = lru.New(maxFutureBlocks) bc.makeCache() @@ -152,9 +147,6 @@ func (bc *ChainManager) SetHead(head *types.Block) { bc.currentBlock = head bc.makeCache() - statedb := state.New(head.Root(), bc.stateDb) - bc.txState = state.ManageState(statedb) - bc.transState = statedb.Copy() bc.setTotalDifficulty(head.Td) bc.insert(head) bc.setLastState() @@ -203,17 +195,6 @@ func (self *ChainManager) State() *state.StateDB { return state.New(self.CurrentBlock().Root(), self.stateDb) } -func (self *ChainManager) TransState() *state.StateDB { - self.tsmu.RLock() - defer self.tsmu.RUnlock() - - return self.transState -} - -func (self *ChainManager) setTransState(statedb *state.StateDB) { - self.transState = statedb -} - func (bc *ChainManager) recover() bool { data, _ := bc.blockDb.Get([]byte("checkpoint")) if len(data) != 0 { @@ -529,9 +510,6 @@ func (self *ChainManager) WriteBlock(block *types.Block, queued bool) (status wr self.insert(block) self.mu.Unlock() - self.setTransState(state.New(block.Root(), self.stateDb)) - self.txState.SetState(state.New(block.Root(), self.stateDb)) - status = CanonStatTy } else { status = SideStatTy |