blockdb

package
v0.0.0-...-791c31d Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2019 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsBlockEq

func IsBlockEq(l, r *types.BlockGeneralInfo) bool

IsBlockEq return if block l == r

func IsChecksum256Eq

func IsChecksum256Eq(l, r types.Checksum256) bool

Types

type BlockDB

type BlockDB struct {
	Peers map[string]*PeerBlockState
}

func (*BlockDB) DelBlockBefore

func (b *BlockDB) DelBlockBefore(num uint32)

func (*BlockDB) Init

func (b *BlockDB) Init(peers []string)

func (*BlockDB) OnBlock

func (b *BlockDB) OnBlock(peer string, block *types.BlockGeneralInfo) error

type FastBlockVerifier

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

func NewFastBlockVerifier

func NewFastBlockVerifier(peers []string, startBlock uint32, verifyHandler VerifyHandler) *FastBlockVerifier

NewFastBlockVerifier create

func (*FastBlockVerifier) OnBlock

func (f *FastBlockVerifier) OnBlock(peer string, block *types.BlockGeneralInfo) error

OnBlock

func (*FastBlockVerifier) TryGetVerifyBlock

func (f *FastBlockVerifier) TryGetVerifyBlock() (*blockItem, bool)

type PeerBlockState

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

func (*PeerBlockState) BlockLen

func (p *PeerBlockState) BlockLen() int

func (*PeerBlockState) DelBlockBefore

func (p *PeerBlockState) DelBlockBefore(num uint32)

DelFirstBlock

func (*PeerBlockState) GetBlock

func (p *PeerBlockState) GetBlock(num uint32) *blockItem

GetFirstBlock

type VerifyHandler

type VerifyHandler interface {
	OnBlock(block *types.BlockGeneralInfo) error
}

Jump to

Keyboard shortcuts

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