mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-02 10:03:45 +00:00
add final & safe headers to BlockStart
This commit is contained in:
parent
0aeec7f1b5
commit
b692a68a3b
2 changed files with 8 additions and 4 deletions
|
|
@ -160,7 +160,7 @@ type BlockchainLogger interface {
|
|||
state.StateLogger
|
||||
// OnBlockStart is called before executing `block`.
|
||||
// `td` is the total difficulty prior to `block`.
|
||||
OnBlockStart(block *types.Block, td *big.Int)
|
||||
OnBlockStart(block *types.Block, td *big.Int, finalized *types.Header, safe *types.Header)
|
||||
OnBlockEnd(err error)
|
||||
OnGenesisBlock(genesis *types.Block)
|
||||
}
|
||||
|
|
@ -1778,7 +1778,7 @@ func (bc *BlockChain) insertChain(chain types.Blocks, setHead bool) (int, error)
|
|||
|
||||
if bc.logger != nil {
|
||||
td := bc.GetTd(block.ParentHash(), block.NumberU64()-1)
|
||||
bc.logger.OnBlockStart(block, td)
|
||||
bc.logger.OnBlockStart(block, td, bc.CurrentFinalBlock(), bc.CurrentSafeBlock())
|
||||
}
|
||||
receipts, logs, usedGas, err := bc.processor.Process(block, statedb, bc.vmConfig)
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -70,8 +70,12 @@ func (p *Printer) CaptureTxEnd(receipt *types.Receipt) {
|
|||
fmt.Printf("CaptureTxEnd: receipt=%s\n", buf)
|
||||
}
|
||||
|
||||
func (p *Printer) OnBlockStart(b *types.Block, td *big.Int) {
|
||||
fmt.Printf("OnBlockStart: b=%v, td=%v\n", b.NumberU64(), td)
|
||||
func (p *Printer) OnBlockStart(b *types.Block, td *big.Int, finalized, safe *types.Header) {
|
||||
if finalized != nil && safe != nil {
|
||||
fmt.Printf("OnBlockStart: b=%v, td=%v, finalized=%v, safe=%v\n", b.NumberU64(), td, finalized.Number.Uint64(), safe.Number.Uint64())
|
||||
} else {
|
||||
fmt.Printf("OnBlockStart: b=%v, td=%v\n", b.NumberU64(), td)
|
||||
}
|
||||
}
|
||||
|
||||
func (p *Printer) OnBlockEnd(err error) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue