Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Block ¶
type Block struct { // BlockHash is a current block hash. BlockHash string // PrevHash is a hash that points to the previouse block. PrevHash string // Time is time of a block. Time time.Time }
Block represents a link in the chain with a block hash and previous hash.
type BlockGapsFinder ¶
type BlockGapsFinder struct {
// contains filtered or unexported fields
}
BlockGapsFinder searches for all possible chains that blocks may form, a head, tail and length are found for each chain. It doesn't track all blocks along a chain, but keeps only head and tail, therefore not all forks and cycles can be spotted, also the current algorithm doesn't find duplicates.
func NewBlockGapsFinder ¶
func NewBlockGapsFinder() *BlockGapsFinder
NewBlockGapsFinder returns an instance of *BlockGapsFinder.
func (*BlockGapsFinder) Append ¶
func (bg *BlockGapsFinder) Append(blks ...*Block) error
Append inpects given blocks and appends info to already inspected. It helps to reduce resource usage during debugging large amount of blocks.
func (*BlockGapsFinder) Result ¶
func (bg *BlockGapsFinder) Result() *BlockGapsResult
type BlockGapsResult ¶
type BlockGapsResult struct {
// contains filtered or unexported fields
}
BlogGapsResult is a result returned after inspecting blocks, it contains info about chains that blocks organized.
func (*BlockGapsResult) Chains ¶
func (bgr *BlockGapsResult) Chains() map[string]*Chain
Chains returns all found chains.
func (*BlockGapsResult) ChainsAsArray ¶
func (bgr *BlockGapsResult) ChainsAsArray() []*Chain
ChainsAsArray returns all found chains, it converts a map of chains to an array.
func (*BlockGapsResult) Print ¶
func (bgr *BlockGapsResult) Print(w io.Writer)
Print prints a debug info to w.