From d865b6405cd69a8a649f32842748ecc907c36974 Mon Sep 17 00:00:00 2001 From: ledgerwatch Date: Thu, 2 Mar 2023 10:34:29 +0000 Subject: [PATCH] Fix nil pointer panic in tracing (#7000) Co-authored-by: Alexey Sharp --- turbo/stages/bodydownload/body_algos.go | 8 +++++--- turbo/transactions/tracing.go | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/turbo/stages/bodydownload/body_algos.go b/turbo/stages/bodydownload/body_algos.go index 449ba01d2..80febe8ca 100644 --- a/turbo/stages/bodydownload/body_algos.go +++ b/turbo/stages/bodydownload/body_algos.go @@ -12,6 +12,7 @@ import ( "github.com/ledgerwatch/erigon-lib/common/length" "github.com/ledgerwatch/erigon-lib/kv" "github.com/ledgerwatch/log/v3" + "golang.org/x/exp/maps" "github.com/ledgerwatch/erigon/core/rawdb" "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.deliveredCount = 0 bd.wastedCount = 0 - bd.deliveriesH = make(map[uint64]*types.Header) - bd.requests = make(map[uint64]*BodyRequest) - bd.peerMap = make(map[[64]byte]int) + maps.Clear(bd.deliveriesH) + maps.Clear(bd.requests) + maps.Clear(bd.peerMap) + //bd.ClearBodyCache() headHeight = bodyProgress headHash, err = rawdb.ReadCanonicalHash(db, headHeight) if err != nil { diff --git a/turbo/transactions/tracing.go b/turbo/transactions/tracing.go index 914986ce5..9ec1844a1 100644 --- a/turbo/transactions/tracing.go +++ b/turbo/transactions/tracing.go @@ -188,7 +188,7 @@ func TraceTx( } var result *core.ExecutionResult - if config.BorTx != nil && *config.BorTx { + if config != nil && config.BorTx != nil && *config.BorTx { callmsg := prepareCallMessage(message) result, err = statefull.ApplyBorMessage(*vmenv, callmsg) } else {