Skip to content

Commit

Permalink
Unnecessary Logs in sentry removed (#10187)
Browse files Browse the repository at this point in the history
Steps to reproduce:
1) Sync snapshots and no other stage
2) Stop
3) No Head Header so hell break loose.
  • Loading branch information
Giulio2002 authored May 3, 2024
1 parent c340b23 commit d61767b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion p2p/sentry/sentry_multi_client/sentry_multi_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,9 @@ func SentryReconnectAndPumpStreamLoop[TMessage interface{}](
statusData, err := statusDataFactory(ctx)

if err != nil {
logger.Error("SentryReconnectAndPumpStreamLoop: statusDataFactory error", "stream", streamName, "err", err)
if !errors.Is(err, sentry.ErrNoHead) {
logger.Error("SentryReconnectAndPumpStreamLoop: statusDataFactory error", "stream", streamName, "err", err)
}
time.Sleep(time.Second)
continue
}
Expand Down
4 changes: 3 additions & 1 deletion p2p/sentry/status_data_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import (
"github.com/ledgerwatch/erigon/core/types"
)

var ErrNoHead = errors.New("ReadChainHead: ReadCurrentHeader error")

type ChainHead struct {
HeadHeight uint64
HeadTime uint64
Expand Down Expand Up @@ -77,7 +79,7 @@ func (s *StatusDataProvider) GetStatusData(ctx context.Context) (*proto_sentry.S
func ReadChainHeadWithTx(tx kv.Tx) (ChainHead, error) {
header := rawdb.ReadCurrentHeaderHavingBody(tx)
if header == nil {
return ChainHead{}, errors.New("ReadChainHead: ReadCurrentHeader error")
return ChainHead{}, ErrNoHead
}

height := header.Number.Uint64()
Expand Down

0 comments on commit d61767b

Please sign in to comment.