[core] blockchain: insert trace event into PostChainEvents

pull/3818/head
peekpi 3 years ago
parent b2472d87c0
commit de5546e85e
  1. 16
      core/blockchain.go

@ -1452,11 +1452,15 @@ func (bc *BlockChain) insertChain(chain types.Blocks, verifyHeaders bool) (int,
} }
vmConfig := bc.vmConfig vmConfig := bc.vmConfig
if bc.trace { if bc.trace {
vmConfig = vm.Config{ ev := TraceEvent{
Debug: true, Block: block,
Tracer: &tracers.ParityBlockTracer{}, Tracer: &tracers.ParityBlockTracer{},
} }
vmConfig = vm.Config{
Debug: true,
Tracer: ev.Tracer,
}
events = append(events, ev)
} }
// Process block using the parent state as reference point. // Process block using the parent state as reference point.
receipts, cxReceipts, logs, usedGas, payout, err := bc.processor.Process( receipts, cxReceipts, logs, usedGas, payout, err := bc.processor.Process(
@ -1483,12 +1487,6 @@ func (bc *BlockChain) insertChain(chain types.Blocks, verifyHeaders bool) (int,
if err != nil { if err != nil {
return i, events, coalescedLogs, err return i, events, coalescedLogs, err
} }
if bc.trace {
bc.PostChainEvents([]interface{}{TraceEvent{
Block: block,
Tracer: vmConfig.Tracer.(*tracers.ParityBlockTracer),
}}, nil)
}
logger := utils.Logger().With(). logger := utils.Logger().With().
Str("number", block.Number().String()). Str("number", block.Number().String()).
Str("hash", block.Hash().Hex()). Str("hash", block.Hash().Hex()).

Loading…
Cancel
Save