Skip to content

Commit

Permalink
rework again
Browse files Browse the repository at this point in the history
  • Loading branch information
cristaloleg committed Jun 3, 2024
1 parent 4c7a15c commit 972c9b2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion store/heightsub.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func (hs *heightSub[H]) Pub(headers ...H) {
height := hs.Height()
from, to := headers[0].Height(), headers[ln-1].Height()
if height+1 != from && height != 0 { // height != 0 is needed to enable init from any height and not only 1
log.Fatalf("PLEASE FILE A BUG REPORT: headers given to the heightSub are in the wrong order: expected %d, got %d", height+1, from)
// log.Fatalf("PLEASE FILE A BUG REPORT: headers given to the heightSub are in the wrong order: expected %d, got %d", height+1, from)
return
}
hs.SetHeight(to)
Expand Down
12 changes: 6 additions & 6 deletions store/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -324,12 +324,12 @@ func (s *Store[H]) Append(ctx context.Context, headers ...H) error {
for i, h := range headers {
// currently store requires all headers to be appended sequentially and adjacently
// TODO(@Wondertan): Further pruning friendly Store design should reevaluate this requirement
if h.Height() != head.Height()+1 {
return &header.ErrNonAdjacent{
Head: head.Height(),
Attempted: h.Height(),
}
}
// if h.Height() != head.Height()+1 {
// return &header.ErrNonAdjacent{
// Head: head.Height(),
// Attempted: h.Height(),
// }
// }

err = head.Verify(h)
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions sync/sync_head.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ func (s *Syncer[H]) setSubjectiveHead(ctx context.Context, netHead H) {
// * Remove ErrNonAdjacent
// * Remove writeHead from the canonical store implementation
err := s.store.Append(ctx, netHead)
var nonAdj *header.ErrNonAdjacent
if err != nil && !errors.As(err, &nonAdj) {
// var nonAdj *header.ErrNonAdjacent
if err != nil { //&& !errors.As(err, &nonAdj) {
// might be a storage error or something else, but we can still try to continue processing netHead
log.Errorw("storing new network header",
"height", netHead.Height(),
Expand Down

0 comments on commit 972c9b2

Please sign in to comment.