Fixed BlockchainLogger.OnBlockEnd called too much times (#19)

The `processBlock` is already doing the work to call `OnBlockEnd`, no need to call it anymore afterwards.
This commit is contained in:
Matthieu Vachon 2023-11-30 10:35:38 -05:00 committed by GitHub
parent 8610f8f68c
commit 72410c399d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 2 additions and 8 deletions

View file

@ -187,7 +187,7 @@ func (pre *Prestate) Apply(vmConfig vm.Config, chainConfig *params.ChainConfig,
}
if beaconRoot := pre.Env.ParentBeaconBlockRoot; beaconRoot != nil {
evm := vm.NewEVM(vmContext, vm.TxContext{}, statedb, chainConfig, vmConfig)
core.ProcessBeaconBlockRoot(*beaconRoot, evm, statedb)
core.ProcessBeaconBlockRoot(*beaconRoot, evm, statedb, nil)
}
var blobGasUsed uint64

View file

@ -1870,9 +1870,6 @@ func (bc *BlockChain) insertChain(chain types.Blocks, setHead bool) (int, error)
// After merge we expect few side chains. Simply count
// all blocks the CL gives us for GC processing time
bc.gcproc += res.procTime
if bc.logger != nil {
bc.logger.OnBlockEnd(nil)
}
return it.index, nil // Direct block insertion of a single block
}
switch res.status {
@ -1901,9 +1898,6 @@ func (bc *BlockChain) insertChain(chain types.Blocks, setHead bool) (int, error)
"txs", len(block.Transactions()), "gas", block.GasUsed(), "uncles", len(block.Uncles()),
"root", block.Root())
}
if bc.logger != nil {
bc.logger.OnBlockEnd(nil)
}
}
// Any blocks remaining here? The only ones we care about are the future ones

View file

@ -36,7 +36,7 @@ func FuzzPrecompiledContracts(f *testing.F) {
return
}
inWant := string(input)
RunPrecompiledContract(p, input, gas)
RunPrecompiledContract(p, input, gas, nil)
if inHave := string(input); inWant != inHave {
t.Errorf("Precompiled %v modified input data", a)
}