Skip to content

Commit ecce2ed

Browse files
committed
remove error logging during fore-handling empty datahash case and handle height from the future error sliently
1 parent 82321d6 commit ecce2ed

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

block/manager.go

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"encoding/hex"
88
"errors"
99
"fmt"
10+
"strings"
1011
"sync"
1112
"sync/atomic"
1213
"time"
@@ -80,6 +81,8 @@ var dataHashForEmptyTxs = []byte{110, 52, 11, 156, 255, 179, 122, 152, 156, 165,
8081
// ErrNoBatch indicate no batch is available for creating block
8182
var ErrNoBatch = errors.New("no batch to process")
8283

84+
var ErrHeightFromFutureStr = "given height is from the future"
85+
8386
// NewHeaderEvent is used to pass header and DA height to headerInCh
8487
type NewHeaderEvent struct {
8588
Header *types.SignedHeader
@@ -582,7 +585,7 @@ func (m *Manager) handleEmptyDataHash(ctx context.Context, header *types.Header)
582585
lastDataHash = lastData.Hash()
583586
}
584587
}
585-
// if err then we cannot populate data, hence just skip and wait for Data to be synced
588+
// if err no error then populate data, otherwise just skip and wait for Data to be synced
586589
if err == nil {
587590
metadata := &types.Metadata{
588591
ChainID: header.ChainID(),
@@ -594,8 +597,6 @@ func (m *Manager) handleEmptyDataHash(ctx context.Context, header *types.Header)
594597
Metadata: metadata,
595598
}
596599
m.dataCache.setData(headerHeight, d)
597-
} else {
598-
m.logger.Error("failed to get block data for", "height", headerHeight-1, "error", err)
599600
}
600601
}
601602
}
@@ -892,10 +893,13 @@ func (m *Manager) RetrieveLoop(ctx context.Context) {
892893
daHeight := atomic.LoadUint64(&m.daHeight)
893894
err := m.processNextDAHeader(ctx)
894895
if err != nil && ctx.Err() == nil {
895-
m.logger.Error("failed to retrieve block from DALC", "daHeight", daHeight, "errors", err.Error())
896+
// if the requested da height is not yet available, wait silently, otherwise log the error and wait
897+
if !strings.Contains(err.Error(), ErrHeightFromFutureStr) {
898+
m.logger.Error("failed to retrieve block from DALC", "daHeight", daHeight, "errors", err.Error())
899+
}
896900
continue
897901
}
898-
// Signal the blockFoundCh to try and retrieve the next block
902+
// Signal the headerFoundCh to try and retrieve the next block
899903
select {
900904
case headerFoundCh <- struct{}{}:
901905
default:

0 commit comments

Comments
 (0)