Documentation ¶
Index ¶
- func GetLatestFinalizedBlock(latestBlock, blockDistanceForFinalizedData int64) int64
- func InterpolateBlocks(timeNow, latestBlockTime time.Time, averageBlockTime time.Duration) int64
- type BlockToHashesToAgreeingProviders
- type ChainBlockStatsGetter
- type FinalizationConsensus
- func (fc *FinalizationConsensus) GetExpectedBlockHeight(chainParser ChainBlockStatsGetter) (expectedBlockHeight int64, numOfProviders int)
- func (fc *FinalizationConsensus) NewEpoch(epoch uint64)
- func (fc *FinalizationConsensus) UpdateFinalizedHashes(blockDistanceForFinalizedData int64, consumerAddress sdk.AccAddress, ...) (finalizationConflict *conflicttypes.FinalizationConflict, err error)
- type FinalizationConsensusInf
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetLatestFinalizedBlock ¶
Types ¶
type ChainBlockStatsGetter ¶
type FinalizationConsensus ¶
type FinalizationConsensus struct { SpecId string // contains filtered or unexported fields }
func NewFinalizationConsensus ¶
func NewFinalizationConsensus(specId string) *FinalizationConsensus
func (*FinalizationConsensus) GetExpectedBlockHeight ¶
func (fc *FinalizationConsensus) GetExpectedBlockHeight(chainParser ChainBlockStatsGetter) (expectedBlockHeight int64, numOfProviders int)
Returns the expected latest block to be at based on the current finalization data, and the number of providers we have information for. It does the calculation on finalized entries then extrapolates the ending based on blockDistance
func (*FinalizationConsensus) NewEpoch ¶
func (fc *FinalizationConsensus) NewEpoch(epoch uint64)
func (*FinalizationConsensus) UpdateFinalizedHashes ¶
func (fc *FinalizationConsensus) UpdateFinalizedHashes(blockDistanceForFinalizedData int64, consumerAddress sdk.AccAddress, providerAddress string, finalizedBlocks map[int64]string, relaySession *pairingtypes.RelaySession, reply *pairingtypes.RelayReply) (finalizationConflict *conflicttypes.FinalizationConflict, err error)
Compare finalized block hashes with previous providers Looks for discrepancy with current epoch providers if no conflicts, insert into consensus and break create new consensus group if no consensus matched check for discrepancy with old epoch checks if there is a consensus mismatch between hashes provided by different providers
type FinalizationConsensusInf ¶
type FinalizationConsensusInf interface { UpdateFinalizedHashes( blockDistanceForFinalizedData int64, consumerAddress sdk.AccAddress, providerAddress string, finalizedBlocks map[int64]string, relaySession *pairingtypes.RelaySession, reply *pairingtypes.RelayReply, ) (finalizationConflict *conflicttypes.FinalizationConflict, err error) GetExpectedBlockHeight(chainParser ChainBlockStatsGetter) (expectedBlockHeight int64, numOfProviders int) NewEpoch(epoch uint64) }
Click to show internal directories.
Click to hide internal directories.