good morning!!!!

Skip to content
Snippets Groups Projects
Commit 0f4b75be authored by Felix Lange's avatar Felix Lange
Browse files

core/state: expose CommitTo

parent d42a56af
No related branches found
No related tags found
No related merge requests found
...@@ -611,7 +611,7 @@ func (s *StateDB) Commit(deleteEmptyObjects bool) (root common.Hash, err error) ...@@ -611,7 +611,7 @@ func (s *StateDB) Commit(deleteEmptyObjects bool) (root common.Hash, err error)
// the root hash stored in a block. // the root hash stored in a block.
func (s *StateDB) CommitBatch(deleteEmptyObjects bool) (root common.Hash, batch ethdb.Batch) { func (s *StateDB) CommitBatch(deleteEmptyObjects bool) (root common.Hash, batch ethdb.Batch) {
batch = s.db.NewBatch() 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()) log.Debug("Trie cache stats after commit", "misses", trie.CacheMisses(), "unloads", trie.CacheUnloads())
return root, batch return root, batch
...@@ -623,7 +623,8 @@ func (s *StateDB) clearJournalAndRefund() { ...@@ -623,7 +623,8 @@ func (s *StateDB) clearJournalAndRefund() {
s.refund = new(big.Int) 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() defer s.clearJournalAndRefund()
// Commit objects to the trie. // Commit objects to the trie.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment