Documentation ¶
Index ¶
- func NewInnerAgency(nodes []params.CbftNode, chain *core.BlockChain, blocksPerNode, offset int) consensus.Agency
- func NewMockAgency(nodes []params.CbftNode, interval uint64) consensus.Agency
- func NewStaticAgency(nodes []params.CbftNode) consensus.Agency
- func NextRound(blockNumber uint64) uint64
- type InnerAgency
- func (ia *InnerAgency) Flush(header *types.Header) error
- func (ia *InnerAgency) GetLastNumber(blockNumber uint64) uint64
- func (ia *InnerAgency) GetValidator(blockNumber uint64) (v *cbfttypes.Validators, err error)
- func (ia *InnerAgency) IsCandidateNode(nodeID enode.IDv0) bool
- func (ia *InnerAgency) OnCommit(block *types.Block) error
- func (ia *InnerAgency) Sign(interface{}) error
- func (ia *InnerAgency) VerifyHeader(header *types.Header, stateDB *state.StateDB) error
- func (ia *InnerAgency) VerifySign(interface{}) error
- type MockAgency
- func (d *MockAgency) Flush(header *types.Header) error
- func (d *MockAgency) GetLastNumber(blockNumber uint64) uint64
- func (d *MockAgency) GetValidator(blockNumber uint64) (*cbfttypes.Validators, error)
- func (d *MockAgency) IsCandidateNode(nodeID enode.IDv0) bool
- func (d *MockAgency) OnCommit(block *types.Block) error
- func (d *MockAgency) Sign(interface{}) error
- func (d *MockAgency) VerifyHeader(header *types.Header, statedb *state.StateDB) error
- func (d *MockAgency) VerifySign(interface{}) error
- type StaticAgency
- func (d *StaticAgency) Flush(header *types.Header) error
- func (d *StaticAgency) GetLastNumber(blockNumber uint64) uint64
- func (d *StaticAgency) GetValidator(uint64) (*cbfttypes.Validators, error)
- func (d *StaticAgency) IsCandidateNode(nodeID enode.IDv0) bool
- func (d *StaticAgency) OnCommit(block *types.Block) error
- func (d *StaticAgency) Sign(interface{}) error
- func (d *StaticAgency) VerifyHeader(header *types.Header, statedb *state.StateDB) error
- func (d *StaticAgency) VerifySign(interface{}) error
- type ValidatorPool
- func (vp *ValidatorPool) Commit(block *types.Block) error
- func (vp *ValidatorPool) EnableVerifyEpoch(epoch uint64) error
- func (vp *ValidatorPool) EqualSwitchPoint(number uint64) bool
- func (vp *ValidatorPool) Flush(header *types.Header) error
- func (vp *ValidatorPool) GetIndexByNodeID(epoch uint64, nodeID enode.ID) (uint32, error)
- func (vp *ValidatorPool) GetNodeIDByIndex(epoch uint64, index int) enode.ID
- func (vp *ValidatorPool) GetValidatorByAddr(epoch uint64, addr common.NodeAddress) (*cbfttypes.ValidateNode, error)
- func (vp *ValidatorPool) GetValidatorByIndex(epoch uint64, index uint32) (*cbfttypes.ValidateNode, error)
- func (vp *ValidatorPool) GetValidatorByNodeID(epoch uint64, nodeID enode.ID) (*cbfttypes.ValidateNode, error)
- func (vp *ValidatorPool) IsCandidateNode(nodeID enode.IDv0) bool
- func (vp *ValidatorPool) IsValidator(epoch uint64, nodeID enode.ID) bool
- func (vp *ValidatorPool) Len(epoch uint64) int
- func (vp *ValidatorPool) MockSwitchPoint(number uint64)
- func (vp *ValidatorPool) Reset(blockNumber uint64, epoch uint64)
- func (vp *ValidatorPool) ShouldSwitch(blockNumber uint64) bool
- func (vp *ValidatorPool) Update(blockNumber uint64, epoch uint64, eventMux *event.TypeMux) error
- func (vp *ValidatorPool) ValidatorList(epoch uint64) []enode.ID
- func (vp *ValidatorPool) Validators(epoch uint64) *cbfttypes.Validators
- func (vp *ValidatorPool) Verify(epoch uint64, validatorIndex uint32, msg, signature []byte) error
- func (vp *ValidatorPool) VerifyAggSig(epoch uint64, validatorIndexes []uint32, msg, signature []byte) bool
- func (vp *ValidatorPool) VerifyAggSigByBA(epoch uint64, vSet *utils.BitArray, msg, signature []byte) error
- func (vp *ValidatorPool) VerifyHeader(header *types.Header) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewInnerAgency ¶
func NewMockAgency ¶ added in v1.0.0
Types ¶
type InnerAgency ¶
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 enode.IDv0) bool
func (*InnerAgency) OnCommit ¶ added in v0.7.3
func (ia *InnerAgency) OnCommit(block *types.Block) error
func (*InnerAgency) Sign ¶
func (ia *InnerAgency) Sign(interface{}) error
func (*InnerAgency) VerifyHeader ¶
func (*InnerAgency) VerifySign ¶
func (ia *InnerAgency) VerifySign(interface{}) error
type MockAgency ¶ added in v1.0.0
func (*MockAgency) GetLastNumber ¶ added in v1.0.0
func (d *MockAgency) GetLastNumber(blockNumber uint64) uint64
func (*MockAgency) GetValidator ¶ added in v1.0.0
func (d *MockAgency) GetValidator(blockNumber uint64) (*cbfttypes.Validators, error)
func (*MockAgency) IsCandidateNode ¶ added in v1.0.0
func (d *MockAgency) IsCandidateNode(nodeID enode.IDv0) bool
func (*MockAgency) OnCommit ¶ added in v1.0.0
func (d *MockAgency) OnCommit(block *types.Block) error
func (*MockAgency) Sign ¶ added in v1.0.0
func (d *MockAgency) Sign(interface{}) error
func (*MockAgency) VerifyHeader ¶ added in v1.0.0
func (*MockAgency) VerifySign ¶ added in v1.0.0
func (d *MockAgency) VerifySign(interface{}) error
type StaticAgency ¶
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 enode.IDv0) bool
func (*StaticAgency) OnCommit ¶ added in v0.7.3
func (d *StaticAgency) OnCommit(block *types.Block) error
func (*StaticAgency) Sign ¶
func (d *StaticAgency) Sign(interface{}) error
func (*StaticAgency) VerifyHeader ¶
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 enode.ID) *ValidatorPool
NewValidatorPool new a validator pool.
func (*ValidatorPool) Commit ¶ added in v0.7.3
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) GetIndexByNodeID ¶
GetIndexByNodeID get the index by node id.
func (*ValidatorPool) GetNodeIDByIndex ¶
func (vp *ValidatorPool) GetNodeIDByIndex(epoch uint64, index int) enode.ID
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 enode.ID) (*cbfttypes.ValidateNode, error)
GetValidatorByNodeID get the validator by node id.
func (*ValidatorPool) IsCandidateNode ¶
func (vp *ValidatorPool) IsCandidateNode(nodeID enode.IDv0) bool
IsCandidateNode check if the node is candidate node.
func (*ValidatorPool) IsValidator ¶
func (vp *ValidatorPool) IsValidator(epoch uint64, nodeID enode.ID) 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 ¶ added in v0.7.3
func (vp *ValidatorPool) MockSwitchPoint(number uint64)
func (*ValidatorPool) Reset ¶ added in v0.7.4
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) ValidatorList ¶
func (vp *ValidatorPool) ValidatorList(epoch uint64) []enode.ID
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 (*ValidatorPool) VerifyHeader ¶
func (vp *ValidatorPool) VerifyHeader(header *types.Header) error
VerifyHeader verify block's header.