Versions in this module Expand all Collapse all v1 v1.1.1 Oct 29, 2019 Changes in this version + const COLOR_BACK_BLACK + const COLOR_BACK_BLUE + const COLOR_BACK_CYAN + const COLOR_BACK_GREEN + const COLOR_BACK_PINK + const COLOR_BACK_RED + const COLOR_BACK_WHITE + const COLOR_BACK_YELLOW + const COLOR_FRONT_BLACK + const COLOR_FRONT_BLUE + const COLOR_FRONT_CYAN + const COLOR_FRONT_GREEN + const COLOR_FRONT_PINK + const COLOR_FRONT_RED + const COLOR_FRONT_WHITE + const COLOR_FRONT_YELLOW + const COLOR_PREFIX + const COLOR_SHORT_RESET + const COLOR_STYLE_DIM + const COLOR_STYLE_HIGHLIGHT + const COLOR_STYLE_RESET + const COLOR_STYLE_REV + const COLOR_STYLE_UNDERLINE + const COLOR_SUFFIX + const ROUND_HANGFOREVER + const ROUND_INSERT_ERR + const ROUND_NO_BLOCK + const ROUND_OK + const ROUND_STOP + const ROUND_WRITE_CERTIFICATE_ERR + const STEP_BP + const STEP_FINAL + const STEP_IDLE + const STEP_REDUCTION_1 + const STEP_REDUCTION_2 + const StepBp + const StepFinal + const StepReduction1 + const StepReduction2 + var ConsensusDataId = "apos" + var ErrAposData = errors.New("apos consensus fail") + var ErrAposID = errors.New("consensus Id is not apos") + var ErrAposSign = errors.New("apos consensus signature is not equal to header") + var ErrBlockTime = errors.New("timestamp less than or equal parent's timestamp") + var ErrCertPHash = errors.New("apos consensus certificate parent hash is not same") + var ErrCertStep = errors.New("apos consensus certificate step is not bba step") + var ErrCertSteps = errors.New("apos consensus certificate step is not same") + var ErrCertVotes = errors.New("apos consensus certificate votes is not enough") + var ErrDuplicateMsg = errors.New("recovery duplicate credential message") + var ErrDuplicatePropagateMsg = errors.New("recovery duplicate Propagate credential message") + var ErrInvalidChainId = errors.New("invalid chain id for signer") + var ErrInvalidSig = errors.New("invalid v, r, s values") + var ErrSignature = errors.New("signature is not right") + var TimeOut types.Hash = types.HexToHash("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff") + func CheckCertificate(header *block.Header, data []byte) error + func Config() *config + func GetCredentialVotes(cs *CredentialSign) float64 + func MsgTransfer() *msgTransfer + func NewMsgBlockProposal(bp *BlockProposal) *msgBlockProposal + func NewMsgByzantineAgreementStar(ba *ByzantineAgreementStar) *msgByzantineAgreementStar + func NewMsgCredential(c *CredentialSign) *msgCredentialSig + type Apos struct + func NewApos(bcHandler BlockChainHandler, producerHandler BlockProducerHandler, ...) *Apos + func (this *Apos) InRecovering() bool + func (this *Apos) SetCoinBase(coinBase types.Address) + func (this *Apos) SetPriKey(priKey *ecdsa.PrivateKey) + func (this *Apos) Start() + type BaEvent struct + Ba *ByzantineAgreementStar + func (z *BaEvent) DecodeMsg(dc *msgp.Reader) (err error) + func (z *BaEvent) EncodeMsg(en *msgp.Writer) (err error) + func (z *BaEvent) MarshalMsg(b []byte) (o []byte, err error) + func (z *BaEvent) Msgsize() (s int) + func (z *BaEvent) UnmarshalMsg(bts []byte) (o []byte, err error) + type BlockCertificate []*CredentialSign + func (z *BlockCertificate) DecodeMsg(dc *msgp.Reader) (err error) + func (z *BlockCertificate) UnmarshalMsg(bts []byte) (o []byte, err error) + func (z BlockCertificate) EncodeMsg(en *msgp.Writer) (err error) + func (z BlockCertificate) MarshalMsg(b []byte) (o []byte, err error) + func (z BlockCertificate) Msgsize() (s int) + type BlockChainHandler interface + CurrentBlock func() *block.Block + CurrentBlockNum func() uint64 + GetBlockByHash func(hash types.Hash) *block.Block + GetBlockByNumber func(number uint64) *block.Block + GetConsensusData func(key types.Hash) []byte + GetDb func() database.IDatabase + GetExtra func(key []byte) []byte + GetHeaderByNumber func(number uint64) *block.Header + GetNowBlockHash func() types.Hash + InsertChain func(chain block.Blocks) (int, error) + StateAt func(root types.Hash) (*state.StateDB, error) + SubscribeChainEvent func(ch chan<- core.ChainEvent) event.Subscription + VerifyNextRoundBlock func(block *block.Block) bool + WriteConsensusData func(key types.Hash, value []byte) error + type BlockProducerHandler interface + GetProducerNewBlock func(data *block.ConsensusData, timeLimit int64) *block.Block + type BlockProposal struct + Block *block.Block + Credential *CredentialSign + Esig *EphemeralSign + func (z *BlockProposal) DecodeMsg(dc *msgp.Reader) (err error) + func (z *BlockProposal) EncodeMsg(en *msgp.Writer) (err error) + func (z *BlockProposal) MarshalMsg(b []byte) (o []byte, err error) + func (z *BlockProposal) Msgsize() (s int) + func (z *BlockProposal) UnmarshalMsg(bts []byte) (o []byte, err error) + type BpEvent struct + Bp *BlockProposal + func (z *BpEvent) DecodeMsg(dc *msgp.Reader) (err error) + func (z *BpEvent) EncodeMsg(en *msgp.Writer) (err error) + func (z *BpEvent) MarshalMsg(b []byte) (o []byte, err error) + func (z *BpEvent) Msgsize() (s int) + func (z *BpEvent) UnmarshalMsg(bts []byte) (o []byte, err error) + type BpObj struct + BpHeap BpWithPriorityHeap + func (this *BpObj) CommitteeVote(data *VoteData) + type BpWithPriority struct + type BpWithPriorityHeap []*BpWithPriority + func (h *BpWithPriorityHeap) Pop() interface{} + func (h *BpWithPriorityHeap) Push(x interface{}) + func (h BpWithPriorityHeap) Len() int + func (h BpWithPriorityHeap) Less(i, j int) bool + func (h BpWithPriorityHeap) Swap(i, j int) + type ByzantineAgreementStar struct + Credential *CredentialSign + Esig *EphemeralSign + Hash types.Hash + func (ba *ByzantineAgreementStar) BaHash() types.Hash + func (z *ByzantineAgreementStar) DecodeMsg(dc *msgp.Reader) (err error) + func (z *ByzantineAgreementStar) EncodeMsg(en *msgp.Writer) (err error) + func (z *ByzantineAgreementStar) MarshalMsg(b []byte) (o []byte, err error) + func (z *ByzantineAgreementStar) Msgsize() (s int) + func (z *ByzantineAgreementStar) UnmarshalMsg(bts []byte) (o []byte, err error) + type CommonCoinMinHash struct + H types.Hash + J int + func (z *CommonCoinMinHash) DecodeMsg(dc *msgp.Reader) (err error) + func (z *CommonCoinMinHash) EncodeMsg(en *msgp.Writer) (err error) + func (z *CommonCoinMinHash) MarshalMsg(b []byte) (o []byte, err error) + func (z *CommonCoinMinHash) Msgsize() (s int) + func (z *CommonCoinMinHash) UnmarshalMsg(bts []byte) (o []byte, err error) + type CommonTools interface + ClearTmpKeys func() + CreateTmpPriKey func(step int) + DelTmpKey func(step int) + ESender func(hash types.Hash, sig []byte) (types.Address, error) + ESigVerify func(hash types.Hash, sig []byte) error + Esig func(pEphemeralSign *EphemeralSign) error + GetBlockByHash func(hash types.Hash) *block.Block + GetBlockByNum func(num uint64) *block.Block + GetBlockCertificate func(blockHash types.Hash) BlockCertificate + GetCoinBase func() types.Address + GetCurrentBlock func() *block.Block + GetLastQrSignature func() []byte + GetNextRound func() int + GetNowBlockHash func() types.Hash + GetNowBlockNum func() uint64 + GetProducerNewBlock func(data *block.ConsensusData, timeLimit int64) *block.Block + GetQrSignature func(round uint64) []byte + GetWeight func(r uint64, addr types.Address) (int64, int64) + InsertChain func(chain block.Blocks) (int, error) + MakeEmptyBlock func(data *block.ConsensusData) *block.Block + SeedSig func(psd *SeedData) error + SetCoinBase func(coinbase types.Address) + SetPriKey func(priKey *ecdsa.PrivateKey) + Sig func(pCs *CredentialSign) error + SigHash func(hash types.Hash) []byte + SubscribeChainEvent func(ch chan<- core.ChainEvent) event.Subscription + VerifyNextRoundBlock func(block *block.Block) bool + WriteBlockCertificate func(blk *block.Block, certificate BlockCertificate) error + type CredentialSigForHash struct + Quantity []byte + Round uint64 + Step uint64 + func (z *CredentialSigForHash) DecodeMsg(dc *msgp.Reader) (err error) + func (z *CredentialSigForHash) EncodeMsg(en *msgp.Writer) (err error) + func (z *CredentialSigForHash) MarshalMsg(b []byte) (o []byte, err error) + func (z *CredentialSigForHash) Msgsize() (s int) + func (z *CredentialSigForHash) UnmarshalMsg(bts []byte) (o []byte, err error) + type CredentialSign struct + ParentHash types.Hash + Round uint64 + Step uint64 + Time *types.BigInt + func (a *CredentialSign) Cmp(b *CredentialSign) int + func (cret *CredentialSign) Sender() (types.Address, error) + func (cs *CredentialSign) CsHash() types.Hash + func (z *CredentialSign) DecodeMsg(dc *msgp.Reader) (err error) + func (z *CredentialSign) EncodeMsg(en *msgp.Writer) (err error) + func (z *CredentialSign) MarshalMsg(b []byte) (o []byte, err error) + func (z *CredentialSign) Msgsize() (s int) + func (z *CredentialSign) UnmarshalMsg(bts []byte) (o []byte, err error) + type CsEvent struct + Cs *CredentialSign + func (z *CsEvent) DecodeMsg(dc *msgp.Reader) (err error) + func (z *CsEvent) EncodeMsg(en *msgp.Writer) (err error) + func (z *CsEvent) MarshalMsg(b []byte) (o []byte, err error) + func (z *CsEvent) Msgsize() (s int) + func (z *CsEvent) UnmarshalMsg(bts []byte) (o []byte, err error) + type EngineApos struct + func NewAposEngine(prv *ecdsa.PrivateKey) *EngineApos + func (this *EngineApos) Author(chain consensus.ChainReader, header *block.Header) (types.Address, error) + func (this *EngineApos) Finalize(chain consensus.ChainReader, header *block.Header, state *state.StateDB, ...) (*block.Block, error) + func (this *EngineApos) Incentive(producer types.Address, state *state.StateDB, header *block.Header) (*transaction.Transaction, error) + func (this *EngineApos) Prepare(chain consensus.ChainReader, header *block.Header) error + func (this *EngineApos) Seal(chain consensus.ChainReader, block *block.Block, stop <-chan struct{}) (*block.Block, error) + func (this *EngineApos) SetKey(prv *ecdsa.PrivateKey) + func (this *EngineApos) VerifyHeader(chain consensus.ChainReader, header *block.Header, seal bool) error + func (this *EngineApos) VerifyHeaders(chain consensus.ChainReader, headers []*block.Header, seals []bool) (chan<- struct{}, <-chan error) + func (this *EngineApos) VerifySeal(chain consensus.ChainReader, header *block.Header) error + type EphemeralSigForHash struct + Round uint64 + Step uint64 + Val []byte + func (z *EphemeralSigForHash) DecodeMsg(dc *msgp.Reader) (err error) + func (z *EphemeralSigForHash) EncodeMsg(en *msgp.Writer) (err error) + func (z *EphemeralSigForHash) MarshalMsg(b []byte) (o []byte, err error) + func (z *EphemeralSigForHash) Msgsize() (s int) + func (z *EphemeralSigForHash) UnmarshalMsg(bts []byte) (o []byte, err error) + type EphemeralSign struct + func (esig *EphemeralSign) GetStep() uint64 + func (z *EphemeralSign) DecodeMsg(dc *msgp.Reader) (err error) + func (z *EphemeralSign) EncodeMsg(en *msgp.Writer) (err error) + func (z *EphemeralSign) MarshalMsg(b []byte) (o []byte, err error) + func (z *EphemeralSign) Msgsize() (s int) + func (z *EphemeralSign) UnmarshalMsg(bts []byte) (o []byte, err error) + type OutMsger interface + GetDataMsg func() <-chan dataPack + PropagateMsg func(dataPack) error + Send2Apos func(dataPack) + SendInner func(dataPack) error + type PriKeyHandler interface + GetBasePriKey func(kind reflect.Type) *ecdsa.PrivateKey + type QuantityEmpty struct + LstQuantity types.Hash + Round uint64 + func (this *QuantityEmpty) Hash() types.Hash + func (z *QuantityEmpty) DecodeMsg(dc *msgp.Reader) (err error) + func (z *QuantityEmpty) EncodeMsg(en *msgp.Writer) (err error) + func (z *QuantityEmpty) MarshalMsg(b []byte) (o []byte, err error) + func (z *QuantityEmpty) Msgsize() (s int) + func (z *QuantityEmpty) UnmarshalMsg(bts []byte) (o []byte, err error) + type Round struct + type SeedData struct + Round uint64 + func (this *SeedData) Hash() types.Hash + func (z *SeedData) DecodeMsg(dc *msgp.Reader) (err error) + func (z *SeedData) EncodeMsg(en *msgp.Writer) (err error) + func (z *SeedData) MarshalMsg(b []byte) (o []byte, err error) + func (z *SeedData) Msgsize() (s int) + func (z *SeedData) UnmarshalMsg(bts []byte) (o []byte, err error) + type SeedDataSigForHash struct + Round uint64 + Seed []byte + func (z *SeedDataSigForHash) DecodeMsg(dc *msgp.Reader) (err error) + func (z *SeedDataSigForHash) EncodeMsg(en *msgp.Writer) (err error) + func (z *SeedDataSigForHash) MarshalMsg(b []byte) (o []byte, err error) + func (z *SeedDataSigForHash) Msgsize() (s int) + func (z *SeedDataSigForHash) UnmarshalMsg(bts []byte) (o []byte, err error) + type Signature struct + R *types.BigInt + S *types.BigInt + V *types.BigInt + func MakeEmptySignature() *Signature + func (s *Signature) FillBySig(sig []byte) (R, S, V *big.Int, err error) + func (s *Signature) Hash() types.Hash + func (s *Signature) Init() + func (z *Signature) DecodeMsg(dc *msgp.Reader) (err error) + func (z *Signature) EncodeMsg(en *msgp.Writer) (err error) + func (z *Signature) MarshalMsg(b []byte) (o []byte, err error) + func (z *Signature) Msgsize() (s int) + func (z *Signature) UnmarshalMsg(bts []byte) (o []byte, err error) + type SortitionPriority interface + type VoteData struct + Round uint64 + Step uint64 + Value types.Hash + type VoteObj struct + SendStatus map[uint64]*VoteData + func (this *VoteObj) CommitteeVote(data *VoteData) + func (this *VoteObj) SendVoteData(r, s uint64, hash types.Hash)