aboutsummaryrefslogtreecommitdiffstats
path: root/ethchain/state.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-03-21 06:38:16 +0800
committerobscuren <geffobscura@gmail.com>2014-03-21 06:38:16 +0800
commitf567f89b994bf28f908410223084a6702d05d156 (patch)
tree1ec45639e8ec6787d1d97ec59c2bd78a7f90d9b0 /ethchain/state.go
parent7705b23f248156878d00c301fbbadafedaf7e3d2 (diff)
downloaddexon-f567f89b994bf28f908410223084a6702d05d156.tar
dexon-f567f89b994bf28f908410223084a6702d05d156.tar.gz
dexon-f567f89b994bf28f908410223084a6702d05d156.tar.bz2
dexon-f567f89b994bf28f908410223084a6702d05d156.tar.lz
dexon-f567f89b994bf28f908410223084a6702d05d156.tar.xz
dexon-f567f89b994bf28f908410223084a6702d05d156.tar.zst
dexon-f567f89b994bf28f908410223084a6702d05d156.zip
Added address to account and contract
Contract and account now both have an address field or method for the sake of simplicity.
Diffstat (limited to 'ethchain/state.go')
-rw-r--r--ethchain/state.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/ethchain/state.go b/ethchain/state.go
index b6750d62d..c9b35da21 100644
--- a/ethchain/state.go
+++ b/ethchain/state.go
@@ -63,8 +63,7 @@ func (s *State) GetContract(addr []byte) *Contract {
}
// build contract
- contract := &Contract{}
- contract.RlpDecode([]byte(data))
+ contract := NewContractFromBytes(addr, []byte(data))
// Check if there's a cached state for this contract
cachedState := s.states[string(addr)]
@@ -78,7 +77,9 @@ func (s *State) GetContract(addr []byte) *Contract {
return contract
}
-func (s *State) UpdateContract(addr []byte, contract *Contract) {
+func (s *State) UpdateContract(contract *Contract) {
+ addr := contract.Address()
+
s.states[string(addr)] = contract.state
s.trie.Update(string(addr), string(contract.RlpEncode()))
}