You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: plugin/evm/customheader/time.go
+46-44Lines changed: 46 additions & 44 deletions
Original file line number
Diff line number
Diff line change
@@ -24,30 +24,23 @@ var (
24
24
ErrTimeMillisecondsRequired=errors.New("TimeMilliseconds is required after Granite activation")
25
25
ErrTimeMillisecondsMismatched=errors.New("TimeMilliseconds does not match header.Time")
26
26
ErrTimeMillisecondsBeforeGranite=errors.New("TimeMilliseconds should be nil before Granite activation")
27
+
ErrMinDelayNotMet=errors.New("minimum block delay not met")
28
+
ErrGraniteClockBehindParent=errors.New("current timestamp is not allowed to be behind than parent timestamp in Granite")
27
29
)
28
30
29
-
// GetNextTimestamp calculates the timestamp (in seconds and milliseconds) for the next child block based on the parent's timestamp and the current time.
30
-
// First return value is the timestamp in seconds, second return value is the timestamp in milliseconds.
31
-
funcGetNextTimestamp(parent*types.Header, now time.Time) (uint64, uint64) {
32
-
var (
33
-
timestamp=uint64(now.Unix())
34
-
timestampMS=uint64(now.UnixMilli())
35
-
)
36
-
// Note: in order to support asynchronous block production, blocks are allowed to have
37
-
// the same timestamp as their parent. This allows more than one block to be produced
38
-
// per second.
31
+
// GetNextTimestamp calculates the time for the next header based on the parent's timestamp and the current time.
32
+
// This can return the parent time if now is before the parent time and TimeMilliseconds is not set (pre-Granite).
33
+
funcGetNextTimestamp(parent*types.Header, now time.Time) time.Time {
0 commit comments