Documentation
¶
Index ¶
- Constants
- type Manager
- func (m *Manager) GetCurrentHeight(ctx context.Context) (uint64, error)
- func (m *Manager) GetCurrentValidatorSet(ctx context.Context, subnetID ids.ID) (map[ids.ID]*validators.GetCurrentValidatorOutput, uint64, error)
- func (m *Manager) GetMinimumHeight(ctx context.Context) (uint64, error)
- func (m *Manager) GetSubnetID(_ context.Context, chainID ids.ID) (ids.ID, error)
- func (m *Manager) GetValidatorSet(ctx context.Context, targetHeight uint64, subnetID ids.ID) (map[ids.NodeID]*validators.GetValidatorOutput, error)
- func (m *Manager) GetWarpValidatorSets(ctx context.Context, targetHeight uint64) (map[ids.ID]validators.WarpSet, error)
- func (m *Manager) OnAcceptedBlockID(blkID ids.ID)
Constants ¶
const ( // MaxRecentlyAcceptedWindowSize is the maximum number of blocks that the // recommended minimum height will lag behind the last accepted block. MaxRecentlyAcceptedWindowSize = 64 // MinRecentlyAcceptedWindowSize is the minimum number of blocks that the // recommended minimum height will lag behind the last accepted block. MinRecentlyAcceptedWindowSize = 0 // RecentlyAcceptedWindowTTL is the amount of time after a block is accepted // to avoid recommending it as the minimum height. The size constraints take // precedence over this time constraint. RecentlyAcceptedWindowTTL = 30 * time.Second )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager implements validators.State and additionally tracks recently accepted block IDs via OnAcceptedBlockID. TODO: Remove requirement for the P-chain's context lock to be held when calling exported functions.
func NewManager ¶
func (*Manager) GetCurrentHeight ¶ added in v1.14.2
func (*Manager) GetCurrentValidatorSet ¶ added in v1.14.2
func (*Manager) GetMinimumHeight ¶ added in v1.14.2
GetMinimumHeight returns the height of the most recent block beyond the horizon of our recentlyAccepted window.
Because the time between blocks is arbitrary, we're only guaranteed that the window's configured TTL amount of time has passed once an element expires from the window.
To try to always return a block older than the window's TTL, we return the parent of the oldest element in the window (as an expired element is always guaranteed to be sufficiently stale). If we haven't expired an element yet in the case of a process restart, we default to the lastAccepted block's height which is likely (but not guaranteed) to also be older than the window's configured TTL.
If [UseCurrentHeight] is true, we override the block selection policy described above and we will always return the last accepted block height as the minimum.
func (*Manager) GetSubnetID ¶ added in v1.14.2
func (*Manager) GetValidatorSet ¶ added in v1.14.2
func (*Manager) GetWarpValidatorSets ¶ added in v1.14.2
func (*Manager) OnAcceptedBlockID ¶
OnAcceptedBlockID registers the ID of the latest accepted block. It is used to update the recentlyAccepted sliding window.