diff options
author | obscuren <geffobscura@gmail.com> | 2014-05-10 08:04:06 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2014-05-10 08:04:06 +0800 |
commit | 3af35d922e5751dcf265d31abf293b759e570fec (patch) | |
tree | 5dbfdb50177d9c7ededabb240f7e792d1174505b /ethchain/state_object.go | |
parent | 2096b3a9edb3289a8f30da81704181dec7b39917 (diff) | |
parent | dbf8645aafb19837d01b939ba9b1d3e1a2fffbf9 (diff) | |
download | dexon-3af35d922e5751dcf265d31abf293b759e570fec.tar dexon-3af35d922e5751dcf265d31abf293b759e570fec.tar.gz dexon-3af35d922e5751dcf265d31abf293b759e570fec.tar.bz2 dexon-3af35d922e5751dcf265d31abf293b759e570fec.tar.lz dexon-3af35d922e5751dcf265d31abf293b759e570fec.tar.xz dexon-3af35d922e5751dcf265d31abf293b759e570fec.tar.zst dexon-3af35d922e5751dcf265d31abf293b759e570fec.zip |
Merge branch 'release/poc5-rc2'
Diffstat (limited to 'ethchain/state_object.go')
-rw-r--r-- | ethchain/state_object.go | 31 |
1 files changed, 3 insertions, 28 deletions
diff --git a/ethchain/state_object.go b/ethchain/state_object.go index 617646077..7a11a1152 100644 --- a/ethchain/state_object.go +++ b/ethchain/state_object.go @@ -77,7 +77,7 @@ func (c *StateObject) SetAddr(addr []byte, value interface{}) { c.state.trie.Update(string(addr), string(ethutil.NewValue(value).Encode())) } -func (c *StateObject) SetMem(num *big.Int, val *ethutil.Value) { +func (c *StateObject) SetStorage(num *big.Int, val *ethutil.Value) { addr := ethutil.BigToBytes(num, 256) c.SetAddr(addr, val) } @@ -160,33 +160,8 @@ func (c *StateObject) RlpDecode(data []byte) { c.script = decoder.Get(3).Bytes() } -// The cached state and state object cache are helpers which will give you somewhat -// control over the nonce. When creating new transactions you're interested in the 'next' -// nonce rather than the current nonce. This to avoid creating invalid-nonce transactions. -type StateObjectCache struct { - cachedObjects map[string]*CachedStateObject -} - -func NewStateObjectCache() *StateObjectCache { - return &StateObjectCache{cachedObjects: make(map[string]*CachedStateObject)} -} - -func (s *StateObjectCache) Add(addr []byte, object *StateObject) *CachedStateObject { - state := &CachedStateObject{Nonce: object.Nonce, Object: object} - s.cachedObjects[string(addr)] = state - - return state -} - -func (s *StateObjectCache) Get(addr []byte) *CachedStateObject { - return s.cachedObjects[string(addr)] -} - -type CachedStateObject struct { - Nonce uint64 - Object *StateObject -} - +// Storage change object. Used by the manifest for notifying changes to +// the sub channels. type StorageState struct { StateAddress []byte Address []byte |