whitelist

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2022 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrCheckpointMismatch = errors.New("checkpoint mismatch")
	ErrNoRemoteCheckoint  = errors.New("remote peer doesn't have a checkoint")
)

Functions

This section is empty.

Types

type Service

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

Checkpoint whitelist

func NewService

func NewService(maxCapacity uint) *Service

func (*Service) GetCheckpointWhitelist

func (w *Service) GetCheckpointWhitelist() map[uint64]common.Hash

GetCheckpointWhitelist returns the existing whitelisted entries of checkpoint of the form block number -> block hash.

func (*Service) IsValidChain

func (w *Service) IsValidChain(currentHeader *types.Header, chain []*types.Header) bool

IsValidChain checks the validity of chain by comparing it against the local checkpoint entries

func (*Service) IsValidPeer

func (w *Service) IsValidPeer(remoteHeader *types.Header, fetchHeadersByNumber func(number uint64, amount int, skip int, reverse bool) ([]*types.Header, []common.Hash, error)) (bool, error)

IsValidPeer checks if the chain we're about to receive from a peer is valid or not in terms of reorgs. We won't reorg beyond the last bor checkpoint submitted to mainchain.

func (*Service) ProcessCheckpoint

func (w *Service) ProcessCheckpoint(endBlockNum uint64, endBlockHash common.Hash)

func (*Service) PurgeCheckpointWhitelist

func (w *Service) PurgeCheckpointWhitelist()

PurgeCheckpointWhitelist purges data from checkpoint whitelist map

Jump to

Keyboard shortcuts

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