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