@@ -72,7 +72,11 @@ func (s *Syncer[H]) Tail(ctx context.Context) (H, error) {
72
72
case s .Params .SyncFromHash != nil :
73
73
tail , err = s .getter .Get (ctx , s .Params .SyncFromHash )
74
74
if err != nil {
75
- return tail , fmt .Errorf ("getting tail header by hash(%s): %w" , s .Params .SyncFromHash , err )
75
+ return tail , fmt .Errorf (
76
+ "getting tail header by hash(%s): %w" ,
77
+ s .Params .SyncFromHash ,
78
+ err ,
79
+ )
76
80
}
77
81
case s .Params .SyncFromHeight != 0 :
78
82
tail , err = s .getter .GetByHeight (ctx , s .Params .SyncFromHeight )
@@ -101,7 +105,11 @@ func (s *Syncer[H]) Tail(ctx context.Context) (H, error) {
101
105
if s .Params .SyncFromHash != nil {
102
106
tail , err = s .getter .Get (ctx , s .Params .SyncFromHash )
103
107
if err != nil {
104
- return tail , fmt .Errorf ("getting tail header by hash(%s): %w" , s .Params .SyncFromHash , err )
108
+ return tail , fmt .Errorf (
109
+ "getting tail header by hash(%s): %w" ,
110
+ s .Params .SyncFromHash ,
111
+ err ,
112
+ )
105
113
}
106
114
} else if s .Params .SyncFromHeight != 0 {
107
115
tail , err = s .getter .GetByHeight (ctx , s .Params .SyncFromHeight )
@@ -154,7 +162,7 @@ func (s *Syncer[H]) subjectiveHead(ctx context.Context) (H, error) {
154
162
storeHead , err := s .store .Head (ctx )
155
163
switch {
156
164
case errors .Is (err , header .ErrEmptyStore ):
157
- log .Infow ("no stored head, initializing..." , "height " )
165
+ log .Info ("no stored head, initializing..." )
158
166
case ! storeHead .IsZero () && isExpired (storeHead , s .Params .TrustingPeriod ):
159
167
log .Infow ("stored head header expired" , "height" , storeHead .Height ())
160
168
default :
@@ -339,8 +347,11 @@ func isRecent[H header.Header[H]](header H, blockTime, recencyThreshold time.Dur
339
347
return time .Since (header .Time ()) <= recencyThreshold
340
348
}
341
349
342
- func estimateTail [H header.Header [H ]](head H , blockTime , trustingPeriod time.Duration ) (height uint64 ) {
343
- headersToRetain := uint64 (trustingPeriod / blockTime )
350
+ func estimateTail [H header.Header [H ]](
351
+ head H ,
352
+ blockTime , trustingPeriod time.Duration ,
353
+ ) (height uint64 ) {
354
+ headersToRetain := uint64 (trustingPeriod / blockTime ) //nolint:gosec
344
355
345
356
if headersToRetain >= head .Height () {
346
357
return 1
0 commit comments