core/state: fixed some comments (#21450)

This commit is contained in:
Giuseppe Bertone
2020-08-19 08:54:21 +02:00
committed by GitHub
parent f3bafecef7
commit 2ff464b29d
3 changed files with 14 additions and 15 deletions

View File

@ -58,7 +58,7 @@ func (n *proofList) Delete(key []byte) error {
panic("not supported")
}
// StateDBs within the ethereum protocol are used to store anything
// StateDB structs within the ethereum protocol are used to store anything
// within the merkle trie. StateDBs take care of caching and storing
// nested states. It's the general query interface to retrieve:
// * Contracts
@ -115,7 +115,7 @@ type StateDB struct {
SnapshotCommits time.Duration
}
// Create a new state from a given trie.
// New creates a new state from a given trie.
func New(root common.Hash, db Database, snaps *snapshot.Tree) (*StateDB, error) {
tr, err := db.OpenTrie(root)
if err != nil {
@ -250,7 +250,7 @@ func (s *StateDB) Empty(addr common.Address) bool {
return so == nil || so.empty()
}
// Retrieve the balance from the given address or 0 if object not found
// GetBalance retrieves the balance from the given address or 0 if object not found
func (s *StateDB) GetBalance(addr common.Address) *big.Int {
stateObject := s.getStateObject(addr)
if stateObject != nil {
@ -318,7 +318,7 @@ func (s *StateDB) GetProof(a common.Address) ([][]byte, error) {
return [][]byte(proof), err
}
// GetProof returns the StorageProof for given key
// GetStorageProof returns the StorageProof for given key
func (s *StateDB) GetStorageProof(a common.Address, key common.Hash) ([][]byte, error) {
var proof proofList
trie := s.StorageTrie(a)
@ -560,7 +560,7 @@ func (s *StateDB) setStateObject(object *stateObject) {
s.stateObjects[object.Address()] = object
}
// Retrieve a state object or create a new state object if nil.
// GetOrNewStateObject retrieves a state object or create a new state object if nil.
func (s *StateDB) GetOrNewStateObject(addr common.Address) *stateObject {
stateObject := s.getStateObject(addr)
if stateObject == nil {