diff --git a/p2p/session.go b/p2p/session.go index f34ab2e2..704437c4 100644 --- a/p2p/session.go +++ b/p2p/session.go @@ -291,7 +291,7 @@ func (s *session[H]) verify(headers []H) error { if trusted.Height() != s.from.Height() { if trusted.Height()+1 != untrusted.Height() { // Exchange requires requested ranges to always consist of adjacent headers. - return fmt.Errorf("peer sent valid??? but non-adjacent header. expected:%d, received:%d", + return fmt.Errorf("peer sent valid but non-adjacent header. expected:%d, received:%d", trusted.Height()+1, untrusted.Height(), ) diff --git a/store/batch.go b/store/batch.go index c861a64e..7785953f 100644 --- a/store/batch.go +++ b/store/batch.go @@ -84,7 +84,7 @@ func (b *batch[H]) Append(headers ...H) { b.lk.Lock() defer b.lk.Unlock() for _, h := range headers { - b.headers = append(b.headers, h) // gap is possible? + b.headers = append(b.headers, h) b.heights[h.Hash().String()] = h.Height() } } diff --git a/store/store.go b/store/store.go index 57140c35..f22ce633 100644 --- a/store/store.go +++ b/store/store.go @@ -395,7 +395,7 @@ func (s *Store[H]) flushLoop() { // and notify waiters if any + increase current read head height // it is important to do Pub after updating pending // so pending is consistent with atomic Height counter on the heightSub - s.heightSub.Pub(headers...) // TODO(oleg): the only place where we mutate heightSub. + s.heightSub.Pub(headers...) // don't flush and continue if pending batch is not grown enough, // and Store is not stopping(headers == nil) if s.pending.Len() < s.Params.WriteBatchSize && headers != nil {