mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-03 10:33:45 +00:00
only emit event for new accounts
This commit is contained in:
parent
057bbdac10
commit
a7de17ed21
2 changed files with 7 additions and 5 deletions
|
|
@ -153,6 +153,8 @@ var defaultCacheConfig = &CacheConfig{
|
|||
SnapshotWait: true,
|
||||
}
|
||||
|
||||
// BlockchainLogger is used to collect traces during chain processing.
|
||||
// Please make a copy of the referenced types if you intend to retain them.
|
||||
type BlockchainLogger interface {
|
||||
vm.EVMLogger
|
||||
state.StateLogger
|
||||
|
|
|
|||
|
|
@ -648,6 +648,10 @@ func (s *StateDB) createObject(addr common.Address) (newobj, prev *stateObject)
|
|||
newobj = newObject(s, addr, types.StateAccount{})
|
||||
if prev == nil {
|
||||
s.journal.append(createObjectChange{account: &addr})
|
||||
// TODO: add isPrecompile check
|
||||
if s.logger != nil {
|
||||
s.logger.OnNewAccount(addr)
|
||||
}
|
||||
} else {
|
||||
// The original account should be marked as destructed and all cached
|
||||
// account and storage data should be cleared as well. Note, it must
|
||||
|
|
@ -678,11 +682,7 @@ func (s *StateDB) createObject(addr common.Address) (newobj, prev *stateObject)
|
|||
prevStorage: storage,
|
||||
})
|
||||
}
|
||||
// TODO: add isPrecompile check
|
||||
// TODO: should we emit on account reset?
|
||||
if s.logger != nil {
|
||||
s.logger.OnNewAccount(addr)
|
||||
}
|
||||
|
||||
s.setStateObject(newobj)
|
||||
if prev != nil && !prev.deleted {
|
||||
return newobj, prev
|
||||
|
|
|
|||
Loading…
Reference in a new issue