Documentation ¶
Index ¶
- Constants
- Variables
- func GenCandidateBallotsPrefix() string
- func GenCandidateNominateKey(address string) string
- func GenCandidateVotePrefix(addrCandi string) string
- func GenNominateRecordsKey(addrNominate, addrCandidate, txid string) string
- func GenNominateRecordsPrefix(addr string) string
- func GenTermCheckKey(version, term int64) string
- func GenVoteCandidatePrefix(addrVoter string) string
- func GetCandidateInfoPrefix() string
- func ParseCandidateBallotsKey(key string) (string, error)
- func ParseCandidateVoteKey(key string) (string, string, error)
- func ParseNominateRecordsKey(key string) (string, string, error)
- func ParseVoteCandidateKey(key string) (string, string, error)
- type CandidateInfo
- type TDpos
- func (tp *TDpos) CheckMinerMatch(header *pb.Header, in *pb.InternalBlock) (bool, error)
- func (tp *TDpos) CompeteMaster(height int64) (bool, bool)
- func (tp *TDpos) Configure(xlog log.Logger, cfg *config.NodeConfig, consCfg map[string]interface{}, ...) error
- func (tp *TDpos) Finalize(blockid []byte) error
- func (tp *TDpos) GetCoreMiners() []*cons_base.MinerInfo
- func (tp *TDpos) GetStatus() *cons_base.ConsensusStatus
- func (tp *TDpos) GetVATWhiteList() map[string]bool
- func (tp *TDpos) GetVerifiableAutogenTx(blockHeight int64, maxCount int, timestamp int64) ([]*pb.Transaction, error)
- func (tp *TDpos) Init()
- func (tp *TDpos) InitCurrent(block *pb.InternalBlock) error
- func (tp *TDpos) ProcessBeforeMiner(timestamp int64) (map[string]interface{}, bool)
- func (tp *TDpos) ProcessConfirmBlock(block *pb.InternalBlock) error
- func (tp *TDpos) ReadOutput(desc *contract.TxDesc) (contract.ContractOutputInterface, error)
- func (tp *TDpos) Rollback(desc *contract.TxDesc) error
- func (tp *TDpos) Run(desc *contract.TxDesc) error
- func (tp *TDpos) SetContext(context *contract.TxContext) error
- func (tp *TDpos) Stop()
- func (tp *TDpos) Type() string
- func (tp *TDpos) Version() int64
Constants ¶
const (
// TYPE the type of tdpos
TYPE = "tdpos"
)
Variables ¶
var ( // ErrProposerNotEnough proposer not enough ErrProposerNotEnough = errors.New("Term publish proposer num less than config") // ErrProposeBlockMoreThanConfig propose block more than config ErrProposeBlockMoreThanConfig = errors.New("Propose block more than config num error") )
Functions ¶
func GenCandidateBallotsPrefix ¶
func GenCandidateBallotsPrefix() string
GenCandidateBallotsPrefix generate candidate ballots prefix
func GenCandidateNominateKey ¶
GenCandidateNominateKey generate candidate nominate key
func GenCandidateVotePrefix ¶
GenCandidateVotePrefix generate candidate vote prefix
func GenNominateRecordsKey ¶
GenNominateRecordsKey generate nominate records key
func GenNominateRecordsPrefix ¶
GenNominateRecordsPrefix generate nominate records prefix
func GenTermCheckKey ¶
GenTermCheckKey generate term check key
func GenVoteCandidatePrefix ¶
GenVoteCandidatePrefix generate candidate vote candidate prefix
func GetCandidateInfoPrefix ¶
func GetCandidateInfoPrefix() string
GetCandidateInfoPrefix generate key prefix of candidate info
func ParseCandidateBallotsKey ¶
ParseCandidateBallotsKey parse candidate ballots key
func ParseCandidateVoteKey ¶
ParseCandidateVoteKey parse candidate vote key
func ParseNominateRecordsKey ¶
ParseNominateRecordsKey parse nominate records key
Types ¶
type CandidateInfo ¶
CandidateInfo define the candidate info
type TDpos ¶
type TDpos struct {
// contains filtered or unexported fields
}
TDpos is struct of tdpos consensus
func (*TDpos) CheckMinerMatch ¶
CheckMinerMatch is the specific implementation of ConsensusInterface
func (*TDpos) CompeteMaster ¶
CompeteMaster is the specific implementation of ConsensusInterface
func (*TDpos) Configure ¶
func (tp *TDpos) Configure(xlog log.Logger, cfg *config.NodeConfig, consCfg map[string]interface{}, extParams map[string]interface{}) error
Configure is the specific implementation of ConsensusInterface
func (*TDpos) GetCoreMiners ¶
GetCoreMiners get the information of core miners
func (*TDpos) GetStatus ¶
func (tp *TDpos) GetStatus() *cons_base.ConsensusStatus
GetStatus get the current status of consensus
func (*TDpos) GetVATWhiteList ¶
GetVATWhiteList the specific implementation of interface VAT
func (*TDpos) GetVerifiableAutogenTx ¶
func (tp *TDpos) GetVerifiableAutogenTx(blockHeight int64, maxCount int, timestamp int64) ([]*pb.Transaction, error)
GetVerifiableAutogenTx is the specific implementation of interface VAT
func (*TDpos) InitCurrent ¶
func (tp *TDpos) InitCurrent(block *pb.InternalBlock) error
InitCurrent is the specific implementation of ConsensusInterface
func (*TDpos) ProcessBeforeMiner ¶
ProcessBeforeMiner is the specific implementation of ConsensusInterface
func (*TDpos) ProcessConfirmBlock ¶
func (tp *TDpos) ProcessConfirmBlock(block *pb.InternalBlock) error
ProcessConfirmBlock is the specific implementation of ConsensusInterface
func (*TDpos) ReadOutput ¶
ReadOutput is the specific implementation of interface contract
func (*TDpos) SetContext ¶
SetContext is the specific implementation of interface contract