github.com/koko1123/flow-go-1@v0.29.6/state/protocol/blocktimer/noop.go (about)

     1  package blocktimer
     2  
     3  import "time"
     4  
     5  // NoopBlockTimer implements an always valid behavior for BlockTimestamp interface.
     6  // Can be used by nodes that don't perform validation of block timestamps.
     7  type NoopBlockTimer struct{}
     8  
     9  func NewNoopBlockTimer() *NoopBlockTimer {
    10  	return &NoopBlockTimer{}
    11  }
    12  
    13  func (n NoopBlockTimer) Build(time.Time) time.Time {
    14  	return time.Now().UTC()
    15  }
    16  
    17  func (n NoopBlockTimer) Validate(time.Time, time.Time) error {
    18  	return nil
    19  }