github.com/onflow/flow-go@v0.35.7-crescendo-preview.23-atree-inlining/consensus/hotstuff/timeout_aggregator.go (about) 1 package hotstuff 2 3 import ( 4 "github.com/onflow/flow-go/consensus/hotstuff/model" 5 "github.com/onflow/flow-go/module" 6 ) 7 8 // TimeoutAggregator verifies and aggregates timeout objects to build timeout certificates [TCs]. 9 // When enough timeout objects are collected, it builds a TC and sends it to the EventLoop 10 // TimeoutAggregator also detects protocol violation, including invalid timeouts, double timeout, etc and 11 // notifies a HotStuff consumer for slashing. 12 type TimeoutAggregator interface { 13 module.ReadyDoneAware 14 module.Startable 15 16 // AddTimeout verifies and aggregates a timeout object. 17 // This method can be called concurrently, timeouts will be queued and processed asynchronously. 18 AddTimeout(timeoutObject *model.TimeoutObject) 19 20 // PruneUpToView deletes all `TimeoutCollector`s _below_ to the given view, as well as 21 // related indices. We only retain and process `TimeoutCollector`s, whose view is equal or larger 22 // than `lowestRetainedView`. If `lowestRetainedView` is smaller than the 23 // previous value, the previous value is kept and the method call is a NoOp. 24 // This value should be set to the latest active view maintained by `Pacemaker`. 25 PruneUpToView(lowestRetainedView uint64) 26 }