MCPcopy
hub / github.com/bnb-chain/bsc / deleteStateObject

Method deleteStateObject

core/state/statedb.go:729–742  ·  view source on GitHub ↗

deleteStateObject removes the given object from the state trie.

(obj *stateObject)

Source from the content-addressed store, hash-verified

727
728// deleteStateObject removes the given object from the state trie.
729func (s *StateDB) deleteStateObject(obj *stateObject) {
730 if s.noTrie {
731 return
732 }
733 // Track the amount of time wasted on deleting the account from the trie
734 if metrics.EnabledExpensive {
735 defer func(start time.Time) { s.AccountUpdates += time.Since(start) }(time.Now())
736 }
737 // Delete the account from the trie
738 addr := obj.Address()
739 if err := s.trie.DeleteAccount(addr); err != nil {
740 s.setError(fmt.Errorf("deleteStateObject (%x) error: %v", addr[:], err))
741 }
742}
743
744// getStateObject retrieves a state object given by the address, returning nil if
745// the object is not found or was deleted in this execution context. If you need

Callers 1

StateIntermediateRootMethod · 0.95

Calls 5

setErrorMethod · 0.95
ErrorfMethod · 0.80
NowMethod · 0.65
AddressMethod · 0.65
DeleteAccountMethod · 0.65

Tested by

no test coverage detected