tdpos

package
v0.0.0-...-d9e9996 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2019 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TYPE the type of tdpos
	TYPE = "tdpos"
)

Variables

View Source
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

func GenCandidateNominateKey(address string) string

GenCandidateNominateKey generate candidate nominate key

func GenCandidateVotePrefix

func GenCandidateVotePrefix(addrCandi string) string

GenCandidateVotePrefix generate candidate vote prefix

func GenNominateRecordsKey

func GenNominateRecordsKey(addrNominate, addrCandidate, txid string) string

GenNominateRecordsKey generate nominate records key

func GenNominateRecordsPrefix

func GenNominateRecordsPrefix(addr string) string

GenNominateRecordsPrefix generate nominate records prefix

func GenTermCheckKey

func GenTermCheckKey(version, term int64) string

GenTermCheckKey generate term check key

func GenVoteCandidatePrefix

func GenVoteCandidatePrefix(addrVoter string) string

GenVoteCandidatePrefix generate candidate vote candidate prefix

func GetCandidateInfoPrefix

func GetCandidateInfoPrefix() string

GetCandidateInfoPrefix generate key prefix of candidate info

func ParseCandidateBallotsKey

func ParseCandidateBallotsKey(key string) (string, error)

ParseCandidateBallotsKey parse candidate ballots key

func ParseCandidateVoteKey

func ParseCandidateVoteKey(key string) (string, string, error)

ParseCandidateVoteKey parse candidate vote key

func ParseNominateRecordsKey

func ParseNominateRecordsKey(key string) (string, string, error)

ParseNominateRecordsKey parse nominate records key

func ParseVoteCandidateKey

func ParseVoteCandidateKey(key string) (string, string, error)

ParseVoteCandidateKey parse vote candidate key

Types

type CandidateInfo

type CandidateInfo struct {
	Address  string
	PeerAddr string
}

CandidateInfo define the candidate info

type TDpos

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

TDpos is struct of tdpos consensus

func (*TDpos) CheckMinerMatch

func (tp *TDpos) CheckMinerMatch(header *pb.Header, in *pb.InternalBlock) (bool, error)

CheckMinerMatch is the specific implementation of ConsensusInterface

func (*TDpos) CompeteMaster

func (tp *TDpos) CompeteMaster(height int64) (bool, bool)

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) Finalize

func (tp *TDpos) Finalize(blockid []byte) error

Finalize is the specific implementation of interface contract

func (*TDpos) GetCoreMiners

func (tp *TDpos) GetCoreMiners() []*cons_base.MinerInfo

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

func (tp *TDpos) GetVATWhiteList() map[string]bool

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) Init

func (tp *TDpos) Init()

Init init tdpos

func (*TDpos) InitCurrent

func (tp *TDpos) InitCurrent(block *pb.InternalBlock) error

InitCurrent is the specific implementation of ConsensusInterface

func (*TDpos) ProcessBeforeMiner

func (tp *TDpos) ProcessBeforeMiner(timestamp int64) (map[string]interface{}, bool)

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

func (tp *TDpos) ReadOutput(desc *contract.TxDesc) (contract.ContractOutputInterface, error)

ReadOutput is the specific implementation of interface contract

func (*TDpos) Rollback

func (tp *TDpos) Rollback(desc *contract.TxDesc) error

Rollback is the specific implementation of interface contract

func (*TDpos) Run

func (tp *TDpos) Run(desc *contract.TxDesc) error

Run is the specific implementation of interface contract

func (*TDpos) SetContext

func (tp *TDpos) SetContext(context *contract.TxContext) error

SetContext is the specific implementation of interface contract

func (*TDpos) Stop

func (tp *TDpos) Stop()

Stop is the specific implementation of interface contract

func (*TDpos) Type

func (tp *TDpos) Type() string

Type return the type of TDpos consensus

func (*TDpos) Version

func (tp *TDpos) Version() int64

Version return the version of TDpos consensus

Directories

Path Synopsis
wrapper for consensus-tdpos plugin
wrapper for consensus-tdpos plugin

Jump to

Keyboard shortcuts

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