good morning!!!!

Skip to content
Snippets Groups Projects
Commit d91357d0 authored by Jeffrey Wilcke's avatar Jeffrey Wilcke
Browse files

Added GetCode method

parent 0fea62ec
No related branches found
No related tags found
No related merge requests found
...@@ -49,6 +49,15 @@ func (self *State) GetNonce(addr []byte) uint64 { ...@@ -49,6 +49,15 @@ func (self *State) GetNonce(addr []byte) uint64 {
return 0 return 0
} }
func (self *State) GetCode(addr []byte) []byte {
stateObject := self.GetStateObject(addr)
if stateObject != nil {
return stateObject.Code
}
return nil
}
// //
// Setting, updating & deleting state object methods // Setting, updating & deleting state object methods
// //
......
...@@ -297,8 +297,12 @@ func (c *StateObject) RlpEncode() []byte { ...@@ -297,8 +297,12 @@ func (c *StateObject) RlpEncode() []byte {
} else { } else {
root = "" root = ""
} }
var codeHash []byte
if len(c.Code) > 0 {
codeHash = ethcrypto.Sha3Bin(c.Code)
}
return ethutil.Encode([]interface{}{c.Nonce, c.Balance, root, ethcrypto.Sha3Bin(c.Code)}) return ethutil.Encode([]interface{}{c.Nonce, c.Balance, root, codeHash})
} }
func (c *StateObject) RlpDecode(data []byte) { func (c *StateObject) RlpDecode(data []byte) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment