Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BlockTimeCalculator ¶
type BlockTimeCalculator struct {
// contains filtered or unexported fields
}
BlockTimeCalculator calculates block time of a given height.
func NewBlockTimeCalculator ¶
func NewBlockTimeCalculator(getBlockInterval getBlockIntervalFn, getTipHeight getTipHeightFn, getHistoryBlockTime getHistoryblockTimeFn) (*BlockTimeCalculator, error)
NewBlockTimeCalculator creates a new BlockTimeCalculator.
func (*BlockTimeCalculator) CalculateBlockTime ¶
func (btc *BlockTimeCalculator) CalculateBlockTime(height uint64) (time.Time, error)
CalculateBlockTime returns the block time of the given height. If the height is in the future, it will predict the block time according to the tip block time and interval. If the height is in the past, it will get the block time from indexer.
Click to show internal directories.
Click to hide internal directories.