|
|
@@ -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 {
|