Skip to content

Commit

Permalink
feat(verify): remove height check in Verify
Browse files Browse the repository at this point in the history
  • Loading branch information
cristaloleg committed Sep 9, 2024
1 parent 8f53979 commit 7983541
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 16 deletions.
9 changes: 0 additions & 9 deletions headertest/verify_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,15 +95,6 @@ func TestVerify(t *testing.T) {
},
err: header.ErrKnownHeader,
},
{
trusted: trusted,
prepare: func() *DummyHeader {
untrusted := next()
untrusted.HeightI += 100000
return untrusted
},
err: header.ErrHeightFromFuture,
},
{
trusted: trusted,
prepare: func() *DummyHeader {
Expand Down
7 changes: 0 additions & 7 deletions verify.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,6 @@ func verify[H Header[H]](trstd, untrstd H, heightThreshold uint64) error {
if known {
return fmt.Errorf("%w: '%d' <= current '%d'", ErrKnownHeader, untrstd.Height(), trstd.Height())
}
// reject headers with height too far from the future
// this is essential for headers failed non-adjacent verification
// yet taken as sync target
adequateHeight := untrstd.Height()-trstd.Height() < heightThreshold
if !adequateHeight {
return fmt.Errorf("%w: '%d' - current '%d' >= threshold '%d'", ErrHeightFromFuture, untrstd.Height(), trstd.Height(), heightThreshold)
}

return nil
}
Expand Down

0 comments on commit 7983541

Please sign in to comment.