[core] blockchain: insert trace event into PostChainEvents

pull/3818/head
peekpi 3 years ago
parent b2472d87c0
commit de5546e85e
  1. 14
      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 {
ev := TraceEvent{
Block: block,
Tracer: &tracers.ParityBlockTracer{},
}
vmConfig = vm.Config{ vmConfig = vm.Config{
Debug: true, Debug: true,
Tracer: ev.Tracer,
Tracer: &tracers.ParityBlockTracer{},
} }
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