This commit is contained in:
Jia Chenhui 2018-03-21 09:29:26 +00:00 committed by GitHub
commit 4fe360da83
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -60,7 +60,7 @@ type StateDB struct {
// DB error. // DB error.
// State objects are used by the consensus core and VM which are // State objects are used by the consensus core and VM which are
// unable to deal with database-level errors. Any error that occurs // unable to deal with database-level errors. Any error that occurs
// during a database read is memoized here and will eventually be returned // during a database read is memorized here and will eventually be returned
// by StateDB.Commit. // by StateDB.Commit.
dbErr error dbErr error
@ -83,7 +83,7 @@ type StateDB struct {
lock sync.Mutex lock sync.Mutex
} }
// Create a new state from a given trie // Create a new state from a given trie.
func New(root common.Hash, db Database) (*StateDB, error) { func New(root common.Hash, db Database) (*StateDB, error) {
tr, err := db.OpenTrie(root) tr, err := db.OpenTrie(root)
if err != nil { if err != nil {
@ -110,7 +110,7 @@ func (self *StateDB) Error() error {
return self.dbErr return self.dbErr
} }
// Reset clears out all emphemeral state objects from the state db, but keeps // Reset clears out all ephemeral state objects from the state db, but keeps
// the underlying state trie to avoid reloading data for the next operations. // the underlying state trie to avoid reloading data for the next operations.
func (self *StateDB) Reset(root common.Hash) error { func (self *StateDB) Reset(root common.Hash) error {
tr, err := self.db.OpenTrie(root) tr, err := self.db.OpenTrie(root)