validator

package
v0.16.3 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2022 License: GPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewInnerAgency

func NewInnerAgency(nodes []params.CbftNode, chain *core.BlockChain, blocksPerNode, offset int) consensus.Agency

func NewMockAgency

func NewMockAgency(nodes []params.CbftNode, interval uint64) consensus.Agency

func NewStaticAgency

func NewStaticAgency(nodes []params.CbftNode) consensus.Agency

func NextRound

func NextRound(blockNumber uint64) uint64

Types

type InnerAgency

type InnerAgency struct {
	consensus.Agency
	// contains filtered or unexported fields
}

func (*InnerAgency) Flush

func (ia *InnerAgency) Flush(header *types.Header) error

func (*InnerAgency) GetLastNumber

func (ia *InnerAgency) GetLastNumber(blockNumber uint64) uint64

func (*InnerAgency) GetValidator

func (ia *InnerAgency) GetValidator(blockNumber uint64) (v *cbfttypes.Validators, err error)

func (*InnerAgency) IsCandidateNode

func (ia *InnerAgency) IsCandidateNode(nodeID discover.NodeID) bool

func (*InnerAgency) OnCommit

func (ia *InnerAgency) OnCommit(block *types.Block) error

func (*InnerAgency) Sign

func (ia *InnerAgency) Sign(interface{}) error

func (*InnerAgency) VerifyHeader

func (ia *InnerAgency) VerifyHeader(header *types.Header, stateDB *state.StateDB) error

func (*InnerAgency) VerifySign

func (ia *InnerAgency) VerifySign(interface{}) error

type MockAgency

type MockAgency struct {
	consensus.Agency
	// contains filtered or unexported fields
}

func (*MockAgency) Flush

func (d *MockAgency) Flush(header *types.Header) error

func (*MockAgency) GetLastNumber

func (d *MockAgency) GetLastNumber(blockNumber uint64) uint64

func (*MockAgency) GetValidator

func (d *MockAgency) GetValidator(blockNumber uint64) (*cbfttypes.Validators, error)

func (*MockAgency) IsCandidateNode

func (d *MockAgency) IsCandidateNode(nodeID discover.NodeID) bool

func (*MockAgency) OnCommit

func (d *MockAgency) OnCommit(block *types.Block) error

func (*MockAgency) Sign

func (d *MockAgency) Sign(interface{}) error

func (*MockAgency) VerifyHeader

func (d *MockAgency) VerifyHeader(header *types.Header, statedb *state.StateDB) error

func (*MockAgency) VerifySign

func (d *MockAgency) VerifySign(interface{}) error

type StaticAgency

type StaticAgency struct {
	consensus.Agency
	// contains filtered or unexported fields
}

func (*StaticAgency) Flush

func (d *StaticAgency) Flush(header *types.Header) error

func (*StaticAgency) GetLastNumber

func (d *StaticAgency) GetLastNumber(blockNumber uint64) uint64

func (*StaticAgency) GetValidator

func (d *StaticAgency) GetValidator(uint64) (*cbfttypes.Validators, error)

func (*StaticAgency) IsCandidateNode

func (d *StaticAgency) IsCandidateNode(nodeID discover.NodeID) bool

func (*StaticAgency) OnCommit

func (d *StaticAgency) OnCommit(block *types.Block) error

func (*StaticAgency) Sign

func (d *StaticAgency) Sign(interface{}) error

func (*StaticAgency) VerifyHeader

func (d *StaticAgency) VerifyHeader(header *types.Header, statedb *state.StateDB) error

func (*StaticAgency) VerifySign

func (d *StaticAgency) VerifySign(interface{}) error

type ValidatorPool

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

ValidatorPool a pool storing validators.

func NewValidatorPool

func NewValidatorPool(agency consensus.Agency, blockNumber uint64, epoch uint64, nodeID discover.NodeID) *ValidatorPool

NewValidatorPool new a validator pool.

func (*ValidatorPool) Commit

func (vp *ValidatorPool) Commit(block *types.Block) error

func (*ValidatorPool) EnableVerifyEpoch

func (vp *ValidatorPool) EnableVerifyEpoch(epoch uint64) error

func (*ValidatorPool) EqualSwitchPoint

func (vp *ValidatorPool) EqualSwitchPoint(number uint64) bool

EqualSwitchPoint returns boolean which representment the switch point equal the inputs number.

func (*ValidatorPool) Flush

func (vp *ValidatorPool) Flush(header *types.Header) error

func (*ValidatorPool) GetIndexByNodeID

func (vp *ValidatorPool) GetIndexByNodeID(epoch uint64, nodeID discover.NodeID) (uint32, error)

GetIndexByNodeID get the index by node id.

func (*ValidatorPool) GetNodeIDByIndex

func (vp *ValidatorPool) GetNodeIDByIndex(epoch uint64, index int) discover.NodeID

GetNodeIDByIndex get the node id by index.

func (*ValidatorPool) GetValidatorByAddr

func (vp *ValidatorPool) GetValidatorByAddr(epoch uint64, addr common.NodeAddress) (*cbfttypes.ValidateNode, error)

GetValidatorByAddr get the validator by address.

func (*ValidatorPool) GetValidatorByIndex

func (vp *ValidatorPool) GetValidatorByIndex(epoch uint64, index uint32) (*cbfttypes.ValidateNode, error)

GetValidatorByIndex get the validator by index.

func (*ValidatorPool) GetValidatorByNodeID

func (vp *ValidatorPool) GetValidatorByNodeID(epoch uint64, nodeID discover.NodeID) (*cbfttypes.ValidateNode, error)

GetValidatorByNodeID get the validator by node id.

func (*ValidatorPool) IsCandidateNode

func (vp *ValidatorPool) IsCandidateNode(nodeID discover.NodeID) bool

IsCandidateNode check if the node is candidate node.

func (*ValidatorPool) IsValidator

func (vp *ValidatorPool) IsValidator(epoch uint64, nodeID discover.NodeID) bool

IsValidator check if the node is validator.

func (*ValidatorPool) Len

func (vp *ValidatorPool) Len(epoch uint64) int

Len return number of validators.

func (*ValidatorPool) MockSwitchPoint

func (vp *ValidatorPool) MockSwitchPoint(number uint64)

func (*ValidatorPool) Reset

func (vp *ValidatorPool) Reset(blockNumber uint64, epoch uint64)

Reset reset validator pool.

func (*ValidatorPool) ShouldSwitch

func (vp *ValidatorPool) ShouldSwitch(blockNumber uint64) bool

ShouldSwitch check if should switch validators at the moment.

func (*ValidatorPool) Update

func (vp *ValidatorPool) Update(blockNumber uint64, epoch uint64, eventMux *event.TypeMux) error

Update switch validators.

func (*ValidatorPool) ValidatorList

func (vp *ValidatorPool) ValidatorList(epoch uint64) []discover.NodeID

ValidatorList get the validator list.

func (*ValidatorPool) Validators

func (vp *ValidatorPool) Validators(epoch uint64) *cbfttypes.Validators

func (*ValidatorPool) Verify

func (vp *ValidatorPool) Verify(epoch uint64, validatorIndex uint32, msg, signature []byte) error

Verify verifies signature using the specified validator's bls public key.

func (*ValidatorPool) VerifyAggSig

func (vp *ValidatorPool) VerifyAggSig(epoch uint64, validatorIndexes []uint32, msg, signature []byte) bool

VerifyAggSig verifies aggregation signature using the specified validators' public keys.

func (*ValidatorPool) VerifyAggSigByBA

func (vp *ValidatorPool) VerifyAggSigByBA(epoch uint64, vSet *utils.BitArray, msg, signature []byte) error

func (*ValidatorPool) VerifyHeader

func (vp *ValidatorPool) VerifyHeader(header *types.Header) error

VerifyHeader verify block's header.

Jump to

Keyboard shortcuts

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