mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-19 21:31:37 +00:00
core/state: add function GetStorageRoot
This commit is contained in:
parent
5223454dee
commit
bbe08ac6e6
2 changed files with 14 additions and 0 deletions
|
|
@ -393,6 +393,10 @@ func (self *stateObject) Nonce() uint64 {
|
|||
return self.data.Nonce
|
||||
}
|
||||
|
||||
func (self *stateObject) Root() common.Hash {
|
||||
return self.data.Root
|
||||
}
|
||||
|
||||
// Never called, but must be present to allow stateObject to be used
|
||||
// as a vm.Account interface that also satisfies the vm.ContractRef
|
||||
// interface. Interfaces are awesome.
|
||||
|
|
|
|||
|
|
@ -221,6 +221,16 @@ func (self *StateDB) GetNonce(addr common.Address) uint64 {
|
|||
return 0
|
||||
}
|
||||
|
||||
// GetStorageRoot retrieves the storage root from the given address or empty
|
||||
// if object not found.
|
||||
func (self *StateDB) GetStorageRoot(addr common.Address) common.Hash {
|
||||
stateObject := self.getStateObject(addr)
|
||||
if stateObject != nil {
|
||||
return stateObject.Root()
|
||||
}
|
||||
return common.Hash{}
|
||||
}
|
||||
|
||||
func (self *StateDB) GetCode(addr common.Address) []byte {
|
||||
stateObject := self.getStateObject(addr)
|
||||
if stateObject != nil {
|
||||
|
|
|
|||
Loading…
Reference in a new issue