Fix nil pointer panic in tracing (#7000)

Co-authored-by: Alexey Sharp <alexeysharp@Alexeys-iMac.local>
This commit is contained in:
ledgerwatch 2023-03-02 10:34:29 +00:00 committed by GitHub
parent 599fc24aed
commit d865b6405c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 4 deletions

View File

@ -12,6 +12,7 @@ import (
"github.com/ledgerwatch/erigon-lib/common/length" "github.com/ledgerwatch/erigon-lib/common/length"
"github.com/ledgerwatch/erigon-lib/kv" "github.com/ledgerwatch/erigon-lib/kv"
"github.com/ledgerwatch/log/v3" "github.com/ledgerwatch/log/v3"
"golang.org/x/exp/maps"
"github.com/ledgerwatch/erigon/core/rawdb" "github.com/ledgerwatch/erigon/core/rawdb"
"github.com/ledgerwatch/erigon/core/types" "github.com/ledgerwatch/erigon/core/types"
@ -40,9 +41,10 @@ func (bd *BodyDownload) UpdateFromDb(db kv.Tx) (headHeight, headTime uint64, hea
bd.delivered.Clear() bd.delivered.Clear()
bd.deliveredCount = 0 bd.deliveredCount = 0
bd.wastedCount = 0 bd.wastedCount = 0
bd.deliveriesH = make(map[uint64]*types.Header) maps.Clear(bd.deliveriesH)
bd.requests = make(map[uint64]*BodyRequest) maps.Clear(bd.requests)
bd.peerMap = make(map[[64]byte]int) maps.Clear(bd.peerMap)
//bd.ClearBodyCache()
headHeight = bodyProgress headHeight = bodyProgress
headHash, err = rawdb.ReadCanonicalHash(db, headHeight) headHash, err = rawdb.ReadCanonicalHash(db, headHeight)
if err != nil { if err != nil {

View File

@ -188,7 +188,7 @@ func TraceTx(
} }
var result *core.ExecutionResult var result *core.ExecutionResult
if config.BorTx != nil && *config.BorTx { if config != nil && config.BorTx != nil && *config.BorTx {
callmsg := prepareCallMessage(message) callmsg := prepareCallMessage(message)
result, err = statefull.ApplyBorMessage(*vmenv, callmsg) result, err = statefull.ApplyBorMessage(*vmenv, callmsg)
} else { } else {