@@ -14,11 +14,10 @@ const DefaultHeightThreshold uint64 = 80000 // ~ 14 days of 15 second headers
14
14
// custom user-specific checks defined in Header.Verify.
15
15
//
16
16
// Given headers must be non-zero
17
- // If heightThreshold is zero, uses DefaultHeightThreshold.
18
17
// Always returns VerifyError.
19
- func Verify [H Header [H ]](trstd , untrstd H , heightThreshold uint64 ) error {
18
+ func Verify [H Header [H ]](trstd , untrstd H ) error {
20
19
// general mandatory verification
21
- err := verify [H ](trstd , untrstd , heightThreshold )
20
+ err := verify [H ](trstd , untrstd )
22
21
if err != nil {
23
22
return & VerifyError {Reason : err }
24
23
}
@@ -46,11 +45,7 @@ func Verify[H Header[H]](trstd, untrstd H, heightThreshold uint64) error {
46
45
47
46
// verify is a little bro of Verify yet performs mandatory Header checks
48
47
// for any Header implementation.
49
- func verify [H Header [H ]](trstd , untrstd H , heightThreshold uint64 ) error {
50
- if heightThreshold == 0 {
51
- heightThreshold = DefaultHeightThreshold
52
- }
53
-
48
+ func verify [H Header [H ]](trstd , untrstd H ) error {
54
49
if trstd .IsZero () {
55
50
return ErrZeroHeader
56
51
}
@@ -75,24 +70,16 @@ func verify[H Header[H]](trstd, untrstd H, heightThreshold uint64) error {
75
70
if known {
76
71
return fmt .Errorf ("%w: '%d' <= current '%d'" , ErrKnownHeader , untrstd .Height (), trstd .Height ())
77
72
}
78
- // reject headers with height too far from the future
79
- // this is essential for headers failed non-adjacent verification
80
- // yet taken as sync target
81
- adequateHeight := untrstd .Height ()- trstd .Height () < heightThreshold
82
- if ! adequateHeight {
83
- return fmt .Errorf ("%w: '%d' - current '%d' >= threshold '%d'" , ErrHeightFromFuture , untrstd .Height (), trstd .Height (), heightThreshold )
84
- }
85
73
86
74
return nil
87
75
}
88
76
89
77
var (
90
- ErrZeroHeader = errors .New ("zero header" )
91
- ErrWrongChainID = errors .New ("wrong chain id" )
92
- ErrUnorderedTime = errors .New ("unordered headers" )
93
- ErrFromFuture = errors .New ("header is from the future" )
94
- ErrKnownHeader = errors .New ("known header" )
95
- ErrHeightFromFuture = errors .New ("header height is far from future" )
78
+ ErrZeroHeader = errors .New ("zero header" )
79
+ ErrWrongChainID = errors .New ("wrong chain id" )
80
+ ErrUnorderedTime = errors .New ("unordered headers" )
81
+ ErrFromFuture = errors .New ("header is from the future" )
82
+ ErrKnownHeader = errors .New ("known header" )
96
83
)
97
84
98
85
// VerifyError is thrown if a Header failed verification.
0 commit comments