Skip to content

Commit

Permalink
Merge pull request #114 from renaynay/recency
Browse files Browse the repository at this point in the history
fix(sync): allow a greater buffer for recency threshold default
  • Loading branch information
renaynay authored Oct 5, 2023
2 parents e7d24b8 + 01a3d06 commit 30117cf
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sync/sync_head.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ func isExpired[H header.Header[H]](header H, period time.Duration) bool {
// isRecent checks if header is recent against the given recency threshold.
func isRecent[H header.Header[H]](header H, blockTime, recencyThreshold time.Duration) bool {
if recencyThreshold == 0 {
recencyThreshold = blockTime + blockTime/2 // allow some drift by adding additional buffer of 1/2 of block time
recencyThreshold = blockTime * 2 // allow some drift by adding additional buffer of 2 blocks
}
return time.Since(header.Time()) <= recencyThreshold
}

0 comments on commit 30117cf

Please sign in to comment.