[tracer] fix bug of nil reference

pull/3818/head
peekpi 3 years ago
parent 9a3ab9fcaa
commit e86282408d
  1. 4
      api/service/explorer/storage.go
  2. 6
      core/blockchain.go
  3. 1
      core/events.go
  4. 6
      hmy/tracers/block_tracer.go

@ -305,7 +305,9 @@ LOOP:
}
traceResult.btc = bc.db.NewBatch()
traceResult.data.ToDB(func(key, value []byte) {
_ = writeTraceResult(traceResult.btc, key, value)
if exist, err := isTraceResultInDB(bc.db, key); !exist && err == nil {
_ = writeTraceResult(traceResult.btc, key, value)
}
})
select {
case bc.resultT <- traceResult:

@ -1453,8 +1453,10 @@ func (bc *BlockChain) insertChain(chain types.Blocks, verifyHeaders bool) (int,
vmConfig := bc.vmConfig
if bc.trace {
ev := TraceEvent{
Block: block,
Tracer: &tracers.ParityBlockTracer{},
Tracer: &tracers.ParityBlockTracer{
Hash: block.Hash(),
Number: block.NumberU64(),
},
}
vmConfig = vm.Config{
Debug: true,

@ -44,7 +44,6 @@ type ChainEvent struct {
}
type TraceEvent struct {
Block *types.Block
Tracer *tracers.ParityBlockTracer
}

@ -203,6 +203,8 @@ type ParityTxTracer struct {
action
}
type ParityBlockTracer struct {
Hash common.Hash
Number uint64
cur *ParityTxTracer
tracers []*ParityTxTracer
}
@ -401,8 +403,8 @@ func (jst *ParityBlockTracer) CaptureEnd(output []byte, gasUsed uint64, t time.D
func (jst *ParityBlockTracer) GetStorage() *TraceBlockStorage {
blockStorage := &TraceBlockStorage{
Hash: jst.cur.blockHash,
Number: jst.cur.blockNumber,
Hash: jst.Hash,
Number: jst.Number,
addressIndex: make(map[common.Address]int),
dataIndex: make(map[common.Hash]int),
}

Loading…
Cancel
Save