Explorar o código

core/state: expose CommitTo

Felix Lange %!s(int64=8) %!d(string=hai) anos
pai
achega
0f4b75bea2
Modificáronse 1 ficheiros con 3 adicións e 2 borrados
  1. 3 2
      core/state/statedb.go

+ 3 - 2
core/state/statedb.go

@@ -611,7 +611,7 @@ func (s *StateDB) Commit(deleteEmptyObjects bool) (root common.Hash, err error)
 // the root hash stored in a block.
 func (s *StateDB) CommitBatch(deleteEmptyObjects bool) (root common.Hash, batch ethdb.Batch) {
 	batch = s.db.NewBatch()
-	root, _ = s.commit(batch, deleteEmptyObjects)
+	root, _ = s.CommitTo(batch, deleteEmptyObjects)
 
 	log.Debug("Trie cache stats after commit", "misses", trie.CacheMisses(), "unloads", trie.CacheUnloads())
 	return root, batch
@@ -623,7 +623,8 @@ func (s *StateDB) clearJournalAndRefund() {
 	s.refund = new(big.Int)
 }
 
-func (s *StateDB) commit(dbw trie.DatabaseWriter, deleteEmptyObjects bool) (root common.Hash, err error) {
+// CommitTo writes the state to the given database.
+func (s *StateDB) CommitTo(dbw trie.DatabaseWriter, deleteEmptyObjects bool) (root common.Hash, err error) {
 	defer s.clearJournalAndRefund()
 
 	// Commit objects to the trie.