Documentation ¶
Index ¶
- Constants
- Variables
- func AddArgsToBlock(view uint64, block *common.Block, txRwSet *common.TxRWSet)
- func GetBlockIdFromQC(qc *maxbft.QuorumCert) []byte
- func GetBlockView(block *common.Block) uint64
- func GetChainConfigFromChainStore(store protocol.BlockchainStore) (*config.ChainConfig, error)
- func GetConfigFromSnapshot(snapshot protocol.Snapshot) (*config.ChainConfig, error)
- func GetConsensusNodes(conf *config.ChainConfig) []string
- func GetGovernanceContractFromChainStore(store protocol.BlockchainStore) (*maxbft.GovernanceContract, error)
- func GetGovernanceContractTxRWSet(governanceContract *maxbft.GovernanceContract) (*common.TxRWSet, error)
- func GetHeightFromQC(qc *maxbft.QuorumCert) uint64
- func GetMiniNodes(consensusNodesNum int) uint
- func GetNodeIdFromSigner(signer *accesscontrol.Member, ac protocol.AccessControlProvider, ...) (nodeId string, err error)
- func GetQCFromBlock(block *common.Block) *maxbft.QuorumCert
- func GetQCHeight(proposal *maxbft.ProposalData) uint64
- func GetQCView(proposal *maxbft.ProposalData) uint64
- func GetQuorum(consensusNodesNum int) uint
- func GetViewFromQC(qc *maxbft.QuorumCert) uint64
- func InsertQCToBlock(block *common.Block, qc *maxbft.QuorumCert)
- func IsValidator(node string, validators []string) bool
- func MustMarshal(msg proto.Message) (data []byte)
Constants ¶
const ( // MaxbftQC defines the key in block.AdditionalData.ExtraData MaxbftQC = "maxbftQC" // BFTNodesNum The number of nodes required to support Byzantium BFTNodesNum = 4 )
const ( // BlockVersion2400 启动随机交易剔除、支持单节点启动等新功能 BlockVersion2400 = uint32(2040000) )
不同的版本启用各种新功能
Variables ¶
var ( // MaxBFTAdditionalQCKey defines the key of qc in block.AdditionalData MaxBFTAdditionalQCKey = "MaxBFTAdditionalQCKey" // RoundTimeoutMill defines the key of view timeout in chainConf RoundTimeoutMill = strings.ToLower("MaxBFTRoundTimeoutMill") // RoundTimeoutIntervalMill defines the key of view increment timeout in chainConf RoundTimeoutIntervalMill = strings.ToLower("MaxBFTRoundTimeoutIntervalMill") // MaxTimeoutMill defines the key of the max view timeout in chainConf MaxTimeoutMill = strings.ToLower("MaxBFTMaxTimeoutMill") // EpochStrategy strategy of the epoch: BaseOnHeight, BaseOnView, Timely, NilEpoch EpochStrategy = strings.ToLower("MaxBFTEpochStrategy") // NumPerEpoch The number of blocks or views in per epoch. NumPerEpoch = strings.ToLower("MaxBFTPerEpochNumber") // ViewNumsPerEpochV230 view num in each epoch on v2.3.0 chainVersion ViewNumsPerEpochV230 = "MaxBftViewNumsPerEpoch" // DefaultRoundTimeout defines the default timeout in a view DefaultRoundTimeout time.Duration = 15000 // DefaultRoundTimeoutInterval defines the default timeout increment in a view DefaultRoundTimeoutInterval time.Duration = 1000 // DefaultMaxRoundTimeout defines the default max timeout in a view 1 min DefaultMaxRoundTimeout time.Duration = 1000 * 60 )
Functions ¶
func AddArgsToBlock ¶
AddArgsToBlock adds txRwSet and view to the specified block
func GetBlockIdFromQC ¶
func GetBlockIdFromQC(qc *maxbft.QuorumCert) []byte
GetBlockIdFromQC returns the block hash in the specified quorum certification
func GetBlockView ¶
GetBlockView returns the view of the specified block
func GetChainConfigFromChainStore ¶
func GetChainConfigFromChainStore(store protocol.BlockchainStore) (*config.ChainConfig, error)
GetChainConfigFromChainStore get the current chain configurations from the chain storage
func GetConfigFromSnapshot ¶
func GetConfigFromSnapshot(snapshot protocol.Snapshot) (*config.ChainConfig, error)
GetConfigFromSnapshot get the current chain configurations from snapshot
func GetConsensusNodes ¶
func GetConsensusNodes(conf *config.ChainConfig) []string
GetConsensusNodes returns consensus nodes in the chain configuration
func GetGovernanceContractFromChainStore ¶
func GetGovernanceContractFromChainStore(store protocol.BlockchainStore) (*maxbft.GovernanceContract, error)
GetGovernanceContractFromChainStore get the current governance contract information from the chain storage
func GetGovernanceContractTxRWSet ¶
func GetGovernanceContractTxRWSet(governanceContract *maxbft.GovernanceContract) (*common.TxRWSet, error)
GetGovernanceContractTxRWSet get the transaction rwSet from the given governance contract object
func GetHeightFromQC ¶
func GetHeightFromQC(qc *maxbft.QuorumCert) uint64
GetHeightFromQC returns the block height in the specified quorum certification
func GetMiniNodes ¶
GetMiniNodes Calculates the number of nodes for f+1, means that there is at least one honest node in the set.
func GetNodeIdFromSigner ¶
func GetNodeIdFromSigner(signer *accesscontrol.Member, ac protocol.AccessControlProvider, net protocol.NetService) (nodeId string, err error)
GetNodeIdFromSigner returns the node to which the specified signer is mapped in Ac module
func GetQCFromBlock ¶
func GetQCFromBlock(block *common.Block) *maxbft.QuorumCert
GetQCFromBlock return the qc in the specified block
func GetQCHeight ¶
func GetQCHeight(proposal *maxbft.ProposalData) uint64
GetQCHeight returns the qc height in the specified proposal
func GetQCView ¶
func GetQCView(proposal *maxbft.ProposalData) uint64
GetQCView returns the view of the specified proposal
func GetQuorum ¶
GetQuorum Counts the number of votes needed to reach a consensus 2f+1
func GetViewFromQC ¶
func GetViewFromQC(qc *maxbft.QuorumCert) uint64
GetViewFromQC returns the view of the specified qc
func InsertQCToBlock ¶
func InsertQCToBlock(block *common.Block, qc *maxbft.QuorumCert)
InsertQCToBlock inserts the specified qc into the specified block
func IsValidator ¶
IsValidator Check whether node is in validators
Types ¶
This section is empty.