Skip to content

Commit a5257bf

Browse files
Unnecessary Logs in sentry removed (#10190)
Cherry pick PR #10187 into the release Co-authored-by: Giulio rebuffo <giulio.rebuffo@gmail.com>
1 parent b59f04c commit a5257bf

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

p2p/sentry/sentry_multi_client/sentry_multi_client.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,9 @@ func SentryReconnectAndPumpStreamLoop[TMessage interface{}](
156156
statusData, err := statusDataFactory(ctx)
157157

158158
if err != nil {
159-
logger.Error("SentryReconnectAndPumpStreamLoop: statusDataFactory error", "stream", streamName, "err", err)
159+
if !errors.Is(err, sentry.ErrNoHead) {
160+
logger.Error("SentryReconnectAndPumpStreamLoop: statusDataFactory error", "stream", streamName, "err", err)
161+
}
160162
time.Sleep(time.Second)
161163
continue
162164
}

p2p/sentry/status_data_provider.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ import (
1818
"github.com/ledgerwatch/erigon/core/types"
1919
)
2020

21+
var ErrNoHead = errors.New("ReadChainHead: ReadCurrentHeader error")
22+
2123
type ChainHead struct {
2224
HeadHeight uint64
2325
HeadTime uint64
@@ -77,7 +79,7 @@ func (s *StatusDataProvider) GetStatusData(ctx context.Context) (*proto_sentry.S
7779
func ReadChainHeadWithTx(tx kv.Tx) (ChainHead, error) {
7880
header := rawdb.ReadCurrentHeaderHavingBody(tx)
7981
if header == nil {
80-
return ChainHead{}, errors.New("ReadChainHead: ReadCurrentHeader error")
82+
return ChainHead{}, ErrNoHead
8183
}
8284

8385
height := header.Number.Uint64()

0 commit comments

Comments
 (0)