protocols

package
v0.0.0-...-8e17a21 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 7, 2020 License: GPL-2.0 Imports: 4 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	WrongNodePositionError = errors.New("wrong node position")
	TimeError              = errors.New("current time before first block")
	DuplicateBlockError    = errors.New("block for this time interval exists")
)

Functions

This section is empty.

Types

type BlockTimeChecker

type BlockTimeChecker interface {
	TimeToGenerate(position int64) (bool, error)
	BlockForTimeExists(t time.Time, nodePosition int) (bool, error)
	RangeByTime(at time.Time) (start, end time.Time, err error)
}

BlockTimeChecker allow check queue to generate current block

type BlockTimeCounter

type BlockTimeCounter struct {
	// contains filtered or unexported fields
}

func NewBlockTimeCounter

func NewBlockTimeCounter() *BlockTimeCounter

NewBlockTimeCounter return initialized BlockTimeCounter

func (*BlockTimeCounter) BlockForTimeExists

func (btc *BlockTimeCounter) BlockForTimeExists(t time.Time, nodePosition int) (bool, error)

BlockForTimeExists checks conformity between time and nodePosition changes functionality of ValidateBlock prevent blockTimeCalculator

func (*BlockTimeCounter) RangeByTime

func (btc *BlockTimeCounter) RangeByTime(t time.Time) (start, end time.Time, err error)

RangeByTime returns start and end of interval by time

func (*BlockTimeCounter) TimeToGenerate

func (btc *BlockTimeCounter) TimeToGenerate(at time.Time, nodePosition int) (bool, error)

TimeToGenerate returns true if the generation queue at time belongs to the specified node

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL