mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-16 17:03:46 +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,
|
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 {
|
type BlockchainLogger interface {
|
||||||
vm.EVMLogger
|
vm.EVMLogger
|
||||||
state.StateLogger
|
state.StateLogger
|
||||||
|
|
|
||||||
|
|
@ -648,6 +648,10 @@ func (s *StateDB) createObject(addr common.Address) (newobj, prev *stateObject)
|
||||||
newobj = newObject(s, addr, types.StateAccount{})
|
newobj = newObject(s, addr, types.StateAccount{})
|
||||||
if prev == nil {
|
if prev == nil {
|
||||||
s.journal.append(createObjectChange{account: &addr})
|
s.journal.append(createObjectChange{account: &addr})
|
||||||
|
// TODO: add isPrecompile check
|
||||||
|
if s.logger != nil {
|
||||||
|
s.logger.OnNewAccount(addr)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// The original account should be marked as destructed and all cached
|
// The original account should be marked as destructed and all cached
|
||||||
// account and storage data should be cleared as well. Note, it must
|
// 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,
|
prevStorage: storage,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
// TODO: add isPrecompile check
|
|
||||||
// TODO: should we emit on account reset?
|
|
||||||
if s.logger != nil {
|
|
||||||
s.logger.OnNewAccount(addr)
|
|
||||||
}
|
|
||||||
s.setStateObject(newobj)
|
s.setStateObject(newobj)
|
||||||
if prev != nil && !prev.deleted {
|
if prev != nil && !prev.deleted {
|
||||||
return newobj, prev
|
return newobj, prev
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue