mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-14 16:03:45 +00:00
Added back OnNewAccount which is Firehose concept so I left it out of the merge commit just before this one
This commit is contained in:
parent
f47d2fc315
commit
7b77261b7c
3 changed files with 11 additions and 0 deletions
|
|
@ -635,6 +635,9 @@ func (s *StateDB) getOrNewStateObject(addr common.Address) *stateObject {
|
||||||
func (s *StateDB) createObject(addr common.Address) (newobj, prev *stateObject) {
|
func (s *StateDB) createObject(addr common.Address) (newobj, prev *stateObject) {
|
||||||
prev = s.getDeletedStateObject(addr) // Note, prev might have been deleted, we need that!
|
prev = s.getDeletedStateObject(addr) // Note, prev might have been deleted, we need that!
|
||||||
newobj = newObject(s, addr, nil)
|
newobj = newObject(s, addr, nil)
|
||||||
|
if s.logger != nil && s.logger.OnNewAccount != nil {
|
||||||
|
s.logger.OnNewAccount(addr, prev != nil)
|
||||||
|
}
|
||||||
if prev == nil {
|
if prev == nil {
|
||||||
s.journal.append(createObjectChange{account: &addr})
|
s.journal.append(createObjectChange{account: &addr})
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -163,6 +163,13 @@ type Hooks struct {
|
||||||
OnCodeChange CodeChangeHook
|
OnCodeChange CodeChangeHook
|
||||||
OnStorageChange StorageChangeHook
|
OnStorageChange StorageChangeHook
|
||||||
OnLog LogHook
|
OnLog LogHook
|
||||||
|
|
||||||
|
// Firehose backward compatibility
|
||||||
|
// This hook exist because some current Firehose supported chains requires it
|
||||||
|
// but this field is going to be deprecated and newer chains will not produced
|
||||||
|
// those events anymore. The hook is registered conditionally based on the
|
||||||
|
// tracer configuration.
|
||||||
|
OnNewAccount func(address common.Address, previousExisted bool)
|
||||||
}
|
}
|
||||||
|
|
||||||
// BalanceChangeReason is used to indicate the reason for a balance change, useful
|
// BalanceChangeReason is used to indicate the reason for a balance change, useful
|
||||||
|
|
|
||||||
|
|
@ -80,6 +80,7 @@ func newFirehoseTracer(cfg json.RawMessage) (*tracing.Hooks, error) {
|
||||||
OnStorageChange: tracer.OnStorageChange,
|
OnStorageChange: tracer.OnStorageChange,
|
||||||
OnGasChange: tracer.OnGasChange,
|
OnGasChange: tracer.OnGasChange,
|
||||||
OnLog: tracer.OnLog,
|
OnLog: tracer.OnLog,
|
||||||
|
OnNewAccount: tracer.OnNewAccount,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue