aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-03-13 21:37:54 +0800
committerobscuren <geffobscura@gmail.com>2015-03-13 21:37:54 +0800
commitcda88ce31a45af001443c71fb16bdb2bbe1efbc7 (patch)
tree251b3340f4666e153bd347aab0c20e526c359bff /core
parentaa9f981d5f9e45d4f92ad3ccd98454aaa59e87c9 (diff)
downloaddexon-cda88ce31a45af001443c71fb16bdb2bbe1efbc7.tar
dexon-cda88ce31a45af001443c71fb16bdb2bbe1efbc7.tar.gz
dexon-cda88ce31a45af001443c71fb16bdb2bbe1efbc7.tar.bz2
dexon-cda88ce31a45af001443c71fb16bdb2bbe1efbc7.tar.lz
dexon-cda88ce31a45af001443c71fb16bdb2bbe1efbc7.tar.xz
dexon-cda88ce31a45af001443c71fb16bdb2bbe1efbc7.tar.zst
dexon-cda88ce31a45af001443c71fb16bdb2bbe1efbc7.zip
Implemented a manage state for keeping track of nonces
Diffstat (limited to 'core')
-rw-r--r--core/chain_manager.go11
1 files changed, 6 insertions, 5 deletions
diff --git a/core/chain_manager.go b/core/chain_manager.go
index df3d6d1c3..7fed7b8b1 100644
--- a/core/chain_manager.go
+++ b/core/chain_manager.go
@@ -86,7 +86,7 @@ type ChainManager struct {
lastBlockHash []byte
transState *state.StateDB
- txState *state.StateDB
+ txState *state.ManagedState
quit chan struct{}
}
@@ -95,7 +95,8 @@ func NewChainManager(blockDb, stateDb ethutil.Database, mux *event.TypeMux) *Cha
bc := &ChainManager{blockDb: blockDb, stateDb: stateDb, genesisBlock: GenesisBlock(stateDb), eventMux: mux, quit: make(chan struct{})}
bc.setLastBlock()
bc.transState = bc.State().Copy()
- bc.txState = bc.State().Copy()
+ // Take ownership of this particular state
+ bc.txState = state.ManageState(bc.State().Copy())
go bc.update()
return bc
@@ -144,17 +145,17 @@ func (self *ChainManager) TransState() *state.StateDB {
return self.transState
}
-func (self *ChainManager) TxState() *state.StateDB {
+func (self *ChainManager) TxState() *state.ManagedState {
self.tsmu.RLock()
defer self.tsmu.RUnlock()
return self.txState
}
-func (self *ChainManager) setTxState(state *state.StateDB) {
+func (self *ChainManager) setTxState(statedb *state.StateDB) {
self.tsmu.Lock()
defer self.tsmu.Unlock()
- self.txState = state
+ self.txState = state.ManageState(statedb)
}
func (self *ChainManager) setTransState(statedb *state.StateDB) {