github.com/koko1123/flow-go-1@v0.29.6/state/protocol/blocktimer.go (about) 1 package protocol 2 3 import ( 4 "time" 5 ) 6 7 // BlockTimer constructs and validates block timestamps. 8 type BlockTimer interface { 9 // Build generates a timestamp based on definition of valid timestamp. 10 Build(parentTimestamp time.Time) time.Time 11 // Validate checks validity of a block's time stamp. 12 // Error returns 13 // * `model.InvalidBlockTimestampError` if time stamp is invalid. 14 // * all other errors are unexpected and potentially symptoms of internal implementation bugs or state corruption (fatal). 15 Validate(parentTimestamp, currentTimestamp time.Time) error 16 }