aboutsummaryrefslogtreecommitdiffstats
path: root/ethchain/state_manager.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-05-09 00:26:46 +0800
committerobscuren <geffobscura@gmail.com>2014-05-09 00:26:46 +0800
commitd709815106824a3469b5f4152fd32705d7d142d4 (patch)
treedb68e4b228f0a46e73a0ca841beacf87e92a68af /ethchain/state_manager.go
parentf0440e85dc306f270666e3aee1fe419b684a2ae8 (diff)
downloadgo-tangerine-d709815106824a3469b5f4152fd32705d7d142d4.tar
go-tangerine-d709815106824a3469b5f4152fd32705d7d142d4.tar.gz
go-tangerine-d709815106824a3469b5f4152fd32705d7d142d4.tar.bz2
go-tangerine-d709815106824a3469b5f4152fd32705d7d142d4.tar.lz
go-tangerine-d709815106824a3469b5f4152fd32705d7d142d4.tar.xz
go-tangerine-d709815106824a3469b5f4152fd32705d7d142d4.tar.zst
go-tangerine-d709815106824a3469b5f4152fd32705d7d142d4.zip
Added trans state and removed watch address etc
The transient state can be used to test out changes before committing them to the proc state. The transient state is currently being used by the gui to support proper nonce updating without having to wait for a block. This used to be done by a cached state mechanism which can now safely by removed.
Diffstat (limited to 'ethchain/state_manager.go')
-rw-r--r--ethchain/state_manager.go24
1 files changed, 8 insertions, 16 deletions
diff --git a/ethchain/state_manager.go b/ethchain/state_manager.go
index b8a893d15..fb5753ab3 100644
--- a/ethchain/state_manager.go
+++ b/ethchain/state_manager.go
@@ -50,6 +50,10 @@ type StateManager struct {
// Comparative state it used for comparing and validating end
// results
compState *State
+ // Transiently state. The trans state isn't ever saved, validated and
+ // it could be used for setting account nonces without effecting
+ // the main states.
+ transState *State
manifest *Manifest
}
@@ -65,6 +69,8 @@ func NewStateManager(ethereum EthManager) *StateManager {
manifest: NewManifest(),
}
sm.procState = ethereum.BlockChain().CurrentBlock.State()
+ sm.transState = sm.procState.Copy()
+
return sm
}
@@ -72,22 +78,8 @@ func (sm *StateManager) ProcState() *State {
return sm.procState
}
-// Watches any given address and puts it in the address state store
-func (sm *StateManager) WatchAddr(addr []byte) *CachedStateObject {
- //XXX account := sm.bc.CurrentBlock.state.GetAccount(addr)
- account := sm.procState.GetAccount(addr)
-
- return sm.stateObjectCache.Add(addr, account)
-}
-
-func (sm *StateManager) GetAddrState(addr []byte) *CachedStateObject {
- account := sm.stateObjectCache.Get(addr)
- if account == nil {
- a := sm.procState.GetAccount(addr)
- account = &CachedStateObject{Nonce: a.Nonce, Object: a}
- }
-
- return account
+func (sm *StateManager) TransState() *State {
+ return sm.transState
}
func (sm *StateManager) BlockChain() *BlockChain {