Documentation ¶
Overview ¶
Package bft implements the BFT consensus engine.
Index ¶
- Constants
- func MaxInt64(a, b int64) int64
- func MaxUInt(a, b uint32) uint32
- func MessageType(msg interface{}) uint64
- func MinInt(a, b int) int
- func MinInt64(a, b int64) int64
- func MinUInt(a, b uint32) uint32
- func NewHandler(cbft *Cbft) *baseHandler
- func NewJournal(path string) (*journal, error)
- func NewPrepareVoteSet(threshold uint32) *prepareVoteSet
- func NewRouter(cbft *Cbft, hd handler) *router
- func Rand32Bytes(n uint32) []byte
- func RandBytes(n int) []byte
- func RandInt31n(n int32) uint32
- func RandIntn(n int) int
- type AcceptStatus
- type Agency
- type BitArray
- func (bA *BitArray) And(o *BitArray) *BitArray
- func (bA *BitArray) Bytes() []byte
- func (bA *BitArray) Copy() *BitArray
- func (bA *BitArray) GetIndex(i uint32) bool
- func (bA *BitArray) IsEmpty() bool
- func (bA *BitArray) IsFull() bool
- func (bA *BitArray) MarshalJSON() ([]byte, error)
- func (bA *BitArray) Not() *BitArray
- func (bA *BitArray) Or(o *BitArray) *BitArray
- func (bA *BitArray) PickRandom() (uint32, bool)
- func (bA *BitArray) SetIndex(i uint32, v bool) bool
- func (bA *BitArray) Size() uint32
- func (bA *BitArray) String() string
- func (bA *BitArray) StringIndented(indent string) string
- func (bA *BitArray) Sub(o *BitArray) *BitArray
- func (bA *BitArray) UnmarshalJSON(bz []byte) error
- func (bA *BitArray) Update(o *BitArray)
- type BlockExt
- func NewBlockExt(block *types.Block, blockNum uint64, threshold int) *BlockExt
- func NewBlockExtByPeer(block *types.Block, blockNum uint64, threshold int) *BlockExt
- func NewBlockExtByPrepareBlock(pb *prepareBlock, threshold int) *BlockExt
- func NewBlockExtBySeal(block *types.Block, blockNum uint64, threshold int) *BlockExt
- func (b BlockExt) BlockExtra() *BlockExtra
- func (b *BlockExt) IsParent(hash common.Hash) bool
- func (b BlockExt) MarshalJSON() ([]byte, error)
- func (b *BlockExt) Merge(ext *BlockExt)
- func (b *BlockExt) PrepareBlock() (*prepareBlock, error)
- func (b *BlockExt) SetSyncState(err error)
- func (b BlockExt) Signs() []common.BlockConfirmSign
- func (b BlockExt) String() string
- func (b BlockExt) Votes() []*prepareVote
- type BlockExtMap
- func (bm *BlockExtMap) Add(hash common.Hash, number uint64, blockExt *BlockExt)
- func (bm *BlockExtMap) BaseBlock(hash common.Hash, number uint64) *BlockExt
- func (bm *BlockExtMap) BlockString() string
- func (bm *BlockExtMap) ClearChildren(hash common.Hash, number uint64, timestamp uint64)
- func (bm *BlockExtMap) ClearParents(hash common.Hash, number uint64)
- func (bm *BlockExtMap) FindHighestConfirmed(hash common.Hash, number uint64) *BlockExt
- func (bm *BlockExtMap) FindHighestConfirmedWithHeader() *BlockExt
- func (bm *BlockExtMap) FindHighestLogical(hash common.Hash, number uint64) *BlockExt
- func (bm *BlockExtMap) GetHasVoteWithoutBlock(highest uint64) []*HashNumberBits
- func (bm *BlockExtMap) GetSubChainUnExecuted() []*BlockExt
- func (bm *BlockExtMap) GetSubChainWithTwoThirdVotes(hash common.Hash, number uint64) []*BlockExt
- func (bm *BlockExtMap) GetWithoutTwoThirdVotes(highest uint64) []*HashNumberBits
- func (bm *BlockExtMap) Len() int
- func (bm *BlockExtMap) RemoveBlock(block *BlockExt)
- func (bm *BlockExtMap) Total() int
- type BlockExtra
- type Breakpoint
- type Cbft
- func (cbft *Cbft) APIs(chain consensus.ChainReader) []rpc.API
- func (cbft *Cbft) AcceptPrepareBlock(request *prepareBlock) AcceptStatus
- func (cbft *Cbft) AcceptPrepareVote(vote *prepareVote) AcceptStatus
- func (cbft *Cbft) AddJournal(msg *MsgInfo)
- func (cbft *Cbft) AddPrepareBlock(block *types.Block)
- func (cbft *Cbft) AddProcessingVote(nodeId discover.NodeID, vote *prepareVote)
- func (cbft *Cbft) AgreeViewChange() bool
- func (cbft *Cbft) Author(header *types.Header) (common.Address, error)
- func (cbft *Cbft) CalcBlockDeadline(timePoint int64) (time.Time, error)
- func (cbft *Cbft) CalcNextBlockTime(timePoint int64) (time.Time, error)
- func (cbft *Cbft) CheckConsensusNode(address common.Address) bool
- func (cbft *Cbft) Clear()
- func (cbft *Cbft) ClearChildren(baseBlockHash common.Hash, baseBlockNum uint64, Timestamp uint64)
- func (cbft *Cbft) ClearPending()
- func (cbft *Cbft) ClearViewChange()
- func (cbft *Cbft) Close() error
- func (cbft *Cbft) CommitBlockBP(block *types.Block, txs int, gasUsed uint64, elapse time.Duration)
- func (cbft *Cbft) ConsensusNodes() ([]discover.NodeID, error)
- func (cbft *Cbft) CurrentBlock() *types.Block
- func (cbft *Cbft) Evidences() string
- func (cbft *Cbft) FastSyncCommitHead() <-chan error
- func (cbft *Cbft) Finalize(chain consensus.ChainReader, header *types.Header, state *state.StateDB, ...) (*types.Block, error)
- func (cbft *Cbft) GetBlock(hash common.Hash, number uint64) *types.Block
- func (cbft *Cbft) GetBlockByHash(hash common.Hash) *types.Block
- func (cbft *Cbft) GetBlockWithoutLock(hash common.Hash, number uint64) *types.Block
- func (cbft *Cbft) HadSendViewChange() bool
- func (cbft *Cbft) HasBlock(hash common.Hash, number uint64) bool
- func (cbft *Cbft) HasTwoThirdsMajorityViewChangeVotes() bool
- func (cbft *Cbft) HighestConfirmedBlock() *types.Block
- func (cbft *Cbft) HighestLogicalBlock() *types.Block
- func (cbft *Cbft) InsertChain(block *types.Block, syncState chan error)
- func (cbft *Cbft) IsConsensusNode() bool
- func (cbft *Cbft) IsSignedBySelf(sealHash common.Hash, signature []byte) bool
- func (cbft *Cbft) NextBaseBlock() *types.Block
- func (cbft *Cbft) OnBaseBlock(ch chan *types.Block)
- func (cbft *Cbft) OnConfirmedPrepareBlock(peerID discover.NodeID, pb *confirmedPrepareBlock) error
- func (cbft *Cbft) OnExecutedBlock(bs *ExecuteBlockStatus)
- func (cbft *Cbft) OnFastSyncCommitHead(errCh chan error)
- func (cbft *Cbft) OnGetBlock(hash common.Hash, number uint64, ch chan *types.Block)
- func (cbft *Cbft) OnGetBlockByHash(hash common.Hash, ch chan *types.Block)
- func (cbft *Cbft) OnGetHighestPrepareBlock(peerID discover.NodeID, msg *getHighestPrepareBlock) error
- func (cbft *Cbft) OnGetPrepareBlock(peerID discover.NodeID, g *getPrepareBlock) error
- func (cbft *Cbft) OnGetPrepareVote(peerID discover.NodeID, pv *getPrepareVote) error
- func (cbft *Cbft) OnHasBlock(block *HasBlock)
- func (cbft *Cbft) OnHighestPrepareBlock(peerID discover.NodeID, msg *highestPrepareBlock) error
- func (cbft *Cbft) OnNewBlock(ext *BlockExt) error
- func (cbft *Cbft) OnNewPrepareBlock(nodeId discover.NodeID, request *prepareBlock, propagation bool) error
- func (cbft *Cbft) OnPong(nodeID discover.NodeID, netLatency int64) error
- func (cbft *Cbft) OnPrepareBlockHash(peerID discover.NodeID, msg *prepareBlockHash) error
- func (cbft *Cbft) OnPrepareVote(peerID discover.NodeID, vote *prepareVote, propagation bool) error
- func (cbft *Cbft) OnPrepareVotes(peerID discover.NodeID, view *prepareVotes) error
- func (cbft *Cbft) OnSeal(sealedBlock *types.Block, sealResultCh chan<- *types.Block, ...)
- func (cbft *Cbft) OnSendViewChange()
- func (cbft *Cbft) OnShouldSeal(shouldSeal chan error)
- func (cbft *Cbft) OnStatus(status chan string)
- func (cbft *Cbft) OnSyncBlock(ext *BlockExt)
- func (cbft *Cbft) OnViewChange(peerID discover.NodeID, view *viewChange) error
- func (cbft *Cbft) OnViewChangeTimeout(view *viewChange)
- func (cbft *Cbft) OnViewChangeVote(peerID discover.NodeID, vote *viewChangeVote) error
- func (cbft *Cbft) OnViewChangeVoteTimeout(view *viewChangeVote)
- func (cbft *Cbft) Prepare(chain consensus.ChainReader, header *types.Header) error
- func (cbft *Cbft) Protocols() []p2p.Protocol
- func (cbft *Cbft) ReceivePeerMsg(msg *MsgInfo)
- func (cbft *Cbft) Seal(chain consensus.ChainReader, block *types.Block, ...) error
- func (cbft *Cbft) SealHash(header *types.Header) common.Hash
- func (cbft *Cbft) SetBlockChainCache(blockChainCache *core.BlockChainCache)
- func (cbft *Cbft) SetBreakpoint(t string)
- func (cbft *Cbft) SetLocalHighestPrepareNum(num uint64)
- func (cbft *Cbft) SetPrivateKey(privateKey *ecdsa.PrivateKey)
- func (cbft *Cbft) ShouldSeal(curTime int64) (bool, error)
- func (cbft *Cbft) Start(blockChain *core.BlockChain, txPool *core.TxPool, agency Agency) error
- func (cbft *Cbft) Status() string
- func (cbft *Cbft) VerifyAndViewChange(view *viewChange) error
- func (cbft *Cbft) VerifyHeader(chain consensus.ChainReader, header *types.Header, seal bool) error
- func (cbft *Cbft) VerifyHeaders(chain consensus.ChainReader, headers []*types.Header, seals []bool) (chan<- struct{}, <-chan error)
- func (cbft *Cbft) VerifySeal(chain consensus.ChainReader, header *types.Header) error
- type ConsensusMsg
- type Context
- type DuplicatePrepareVoteEvidence
- func (d DuplicatePrepareVoteEvidence) Address() common.Address
- func (d DuplicatePrepareVoteEvidence) BlockNumber() uint64
- func (d DuplicatePrepareVoteEvidence) Equal(ev Evidence) bool
- func (d DuplicatePrepareVoteEvidence) Error() string
- func (d DuplicatePrepareVoteEvidence) Hash() []byte
- func (d DuplicatePrepareVoteEvidence) Validate() error
- func (d DuplicatePrepareVoteEvidence) Verify(pub ecdsa.PublicKey) error
- type DuplicateViewChangeVoteEvidence
- func (d DuplicateViewChangeVoteEvidence) Address() common.Address
- func (d DuplicateViewChangeVoteEvidence) BlockNumber() uint64
- func (d DuplicateViewChangeVoteEvidence) Equal(ev Evidence) bool
- func (d DuplicateViewChangeVoteEvidence) Error() string
- func (d DuplicateViewChangeVoteEvidence) Hash() []byte
- func (d DuplicateViewChangeVoteEvidence) Validate() error
- func (d DuplicateViewChangeVoteEvidence) Verify(pub ecdsa.PublicKey) error
- type Evidence
- type EvidenceData
- type EvidencePool
- type ExecuteBlockStatus
- type GetBlock
- type HasBlock
- type HashNumberBits
- type IWALDatabase
- type InnerAgency
- func (ia *InnerAgency) GetLastNumber(blockNumber uint64) uint64
- func (ia *InnerAgency) GetValidator(blockNumber uint64) (v *Validators, err error)
- func (ia *InnerAgency) IsCandidateNode(nodeID discover.NodeID) bool
- func (ia *InnerAgency) Sign(interface{}) error
- func (ia *InnerAgency) VerifySign(interface{}) error
- type InternalBP
- type JournalMessage
- type JournalMessageCbftStatusData
- type JournalMessageConfirmedPrepareBlock
- type JournalMessageGetHighestPrepareBlock
- type JournalMessageGetPrepareBlock
- type JournalMessageGetPrepareVote
- type JournalMessageHighestPrepareBlock
- type JournalMessagePrepareBlock
- type JournalMessagePrepareBlockHash
- type JournalMessagePrepareVote
- type JournalMessagePrepareVotes
- type JournalMessageViewChange
- type JournalMessageViewChangeVote
- type LogRecord
- type Message
- type MsgInfo
- type MsgInfoCbftStatusData
- type MsgInfoConfirmedPrepareBlock
- type MsgInfoGetHighestPrepareBlock
- type MsgInfoGetPrepareBlock
- type MsgInfoGetPrepareVote
- type MsgInfoHighestPrepareBlock
- type MsgInfoPrepareBlock
- type MsgInfoPrepareBlockHash
- type MsgInfoPrepareVote
- type MsgInfoPrepareVotes
- type MsgInfoViewChange
- type MsgInfoViewChangeVote
- type MsgPackage
- type NumberOrderPrepare
- type NumberOrderViewChange
- type PendingBlock
- type PendingVote
- type PrepareBP
- type PrepareEvidence
- type ProcessingVote
- type ProducerBlocks
- func (pb *ProducerBlocks) AddBlock(block *types.Block)
- func (pb *ProducerBlocks) Author() discover.NodeID
- func (pb *ProducerBlocks) ExistBlock(block *types.Block) bool
- func (pb *ProducerBlocks) Len() int
- func (pb *ProducerBlocks) MaxSequenceBlock() *types.Block
- func (pb *ProducerBlocks) MaxSequenceBlockNum() uint64
- func (pb *ProducerBlocks) SetAuthor(author discover.NodeID)
- func (pb ProducerBlocks) String() string
- type RoundState
- type SealBlock
- type Span
- type StaticAgency
- type SyncBlockBP
- type Tag
- type TimeOrderViewChange
- type TimestampViewChangeVoteEvidence
- func (d TimestampViewChangeVoteEvidence) Address() common.Address
- func (d TimestampViewChangeVoteEvidence) BlockNumber() uint64
- func (d TimestampViewChangeVoteEvidence) Equal(ev Evidence) bool
- func (d TimestampViewChangeVoteEvidence) Error() string
- func (d TimestampViewChangeVoteEvidence) Hash() []byte
- func (d TimestampViewChangeVoteEvidence) Validate() error
- func (d TimestampViewChangeVoteEvidence) Verify(pub ecdsa.PublicKey) error
- type ValidateNode
- type ValidateNodeMap
- type Validators
- func (vs *Validators) AddressIndex(addr common.Address) (*ValidateNode, error)
- func (vs *Validators) Equal(rsh *Validators) bool
- func (vs *Validators) Len() int
- func (vs *Validators) NodeID(idx int) discover.NodeID
- func (vs *Validators) NodeIndex(id discover.NodeID) (*ValidateNode, error)
- func (vs *Validators) NodeIndexAddress(id discover.NodeID) (*ValidateNode, error)
- func (vs *Validators) NodeList() []discover.NodeID
- func (vs *Validators) String() string
- type ViewChangeBP
- type ViewChangeMessage
- type ViewChangeMeta
- type ViewChangeVotes
- type ViewNumberEvidence
- type ViewTimeEvidence
- type WALDatabase
- func (db *WALDatabase) Close()
- func (db *WALDatabase) Delete(key []byte) error
- func (db *WALDatabase) Get(key []byte) ([]byte, error)
- func (db *WALDatabase) Has(key []byte) (bool, error)
- func (db *WALDatabase) Path() string
- func (db *WALDatabase) Put(key []byte, value []byte, wo *opt.WriteOptions) error
- type Wal
- type WriterWrapper
Constants ¶
const ( MixMode = iota // all consensus node PartMode // partial node FullMode // all node )
const ( PrepareBlockMsg = 0x00 PrepareVoteMsg = 0x01 ViewChangeMsg = 0x02 ViewChangeVoteMsg = 0x03 ConfirmedPrepareBlockMsg = 0x04 GetPrepareVoteMsg = 0x05 PrepareVotesMsg = 0x06 GetPrepareBlockMsg = 0x07 GetHighestPrepareBlockMsg = 0x08 HighestPrepareBlockMsg = 0x09 CBFTStatusMsg = 0x0a PrepareBlockHashMsg = 0x0b )
const ( ErrMsgTooLarge = iota ErrDecode ErrInvalidMsgCode ErrProtocolVersionMismatch ErrNetworkIdMismatch ErrGenesisBlockMismatch ErrNoStatusMsg ErrExtraStatusMsg ErrSuspendedPeer )
const ( Accept = iota Discard Cache )
const CbftProtocolMaxMsgSize = 10 * 1024 * 1024
const (
DEFAULT_FANOUT_VALUE = 5
)
const (
LOG_PREFIX = "OPENTRACE"
)
const (
NONE = "NONE"
)
Variables ¶
This section is empty.
Functions ¶
func MessageType ¶
func MessageType(msg interface{}) uint64
func NewHandler ¶
func NewHandler(cbft *Cbft) *baseHandler
func NewJournal ¶
newTxJournal creates journal object
func NewPrepareVoteSet ¶
func NewPrepareVoteSet(threshold uint32) *prepareVoteSet
func Rand32Bytes ¶
func RandInt31n ¶
Types ¶
type AcceptStatus ¶
type AcceptStatus int
type Agency ¶
type Agency interface { Sign(msg interface{}) error VerifySign(msg interface{}) error GetLastNumber(blockNumber uint64) uint64 GetValidator(blockNumber uint64) (*Validators, error) IsCandidateNode(nodeID discover.NodeID) bool }
Agency
func NewInnerAgency ¶
func NewStaticAgency ¶
type BitArray ¶
type BitArray struct { Bits uint32 `json:"bits"` // NOTE: persisted via reflect, must be exported Elems []uint64 `json:"elems"` // NOTE: persisted via reflect, must be exported }
BitArray is a thread-unsafe implementation of a bit array.
func NewBitArray ¶
NewBitArray returns a new bit array. It returns nil if the number of bits is zero.
func (*BitArray) And ¶
And returns a bit array resulting from a bitwise AND of the two bit arrays. If the two bit-arrys have different lengths, this truncates the larger of the two bit-arrays from the right. Thus the size of the return value is the minimum of the two provided bit arrays.
func (*BitArray) GetIndex ¶
GetIndex returns the bit at index i within the bit array. The behavior is undefined if i >= bA.Bits
func (*BitArray) MarshalJSON ¶
MarshalJSON implements json.Marshaler interface by marshaling bit array using a custom format: a string of '-' or 'x' where 'x' denotes the 1 bit.
func (*BitArray) Not ¶
Not returns a bit array resulting from a bitwise Not of the provided bit array.
func (*BitArray) Or ¶
Or returns a bit array resulting from a bitwise OR of the two bit arrays. If the two bit-arrys have different lengths, Or right-pads the smaller of the two bit-arrays with zeroes. Thus the size of the return value is the maximum of the two provided bit arrays.
func (*BitArray) PickRandom ¶
PickRandom returns a random index for a set bit in the bit array. If there is no such value, it returns 0, false. It uses the global randomness in `random.go` to get this index.
func (*BitArray) SetIndex ¶
SetIndex sets the bit at index i within the bit array. The behavior is undefined if i >= bA.Bits
func (*BitArray) String ¶
String returns a string representation of BitArray: BA{<bit-string>}, where <bit-string> is a sequence of 'x' (1) and '_' (0). The <bit-string> includes spaces and newlines to help people. For a simple sequence of 'x' and '_' characters with no spaces or newlines, see the MarshalJSON() method. Example: "BA{_x_}" or "nil-BitArray" for nil.
func (*BitArray) StringIndented ¶
StringIndented returns the same thing as String(), but applies the indent at every 10th bit, and twice at every 50th bit.
func (*BitArray) Sub ¶
Sub subtracts the two bit-arrays bitwise, without carrying the bits. Note that carryless subtraction of a - b is (a and not b). The output is the same as bA, regardless of o's size. If bA is longer than o, o is right padded with zeroes
func (*BitArray) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler interface by unmarshaling a custom JSON description.
type BlockExt ¶
type BlockExt struct {
// contains filtered or unexported fields
}
BlockExt is an extension from Block
func NewBlockExt ¶
New creates a BlockExt object
func NewBlockExtByPeer ¶
func NewBlockExtBySeal ¶
func (BlockExt) BlockExtra ¶
func (b BlockExt) BlockExtra() *BlockExtra
func (BlockExt) MarshalJSON ¶
func (*BlockExt) PrepareBlock ¶
func (*BlockExt) SetSyncState ¶
func (BlockExt) Signs ¶
func (b BlockExt) Signs() []common.BlockConfirmSign
type BlockExtMap ¶
type BlockExtMap struct {
// contains filtered or unexported fields
}
func NewBlockExtMap ¶
func NewBlockExtMap(baseBlock *BlockExt, threshold int) *BlockExtMap
func (*BlockExtMap) Add ¶
func (bm *BlockExtMap) Add(hash common.Hash, number uint64, blockExt *BlockExt)
func (*BlockExtMap) BaseBlock ¶
func (bm *BlockExtMap) BaseBlock(hash common.Hash, number uint64) *BlockExt
func (*BlockExtMap) BlockString ¶
func (bm *BlockExtMap) BlockString() string
func (*BlockExtMap) ClearChildren ¶
func (bm *BlockExtMap) ClearChildren(hash common.Hash, number uint64, timestamp uint64)
func (*BlockExtMap) ClearParents ¶
func (bm *BlockExtMap) ClearParents(hash common.Hash, number uint64)
func (*BlockExtMap) FindHighestConfirmed ¶
func (bm *BlockExtMap) FindHighestConfirmed(hash common.Hash, number uint64) *BlockExt
func (*BlockExtMap) FindHighestConfirmedWithHeader ¶
func (bm *BlockExtMap) FindHighestConfirmedWithHeader() *BlockExt
func (*BlockExtMap) FindHighestLogical ¶
func (bm *BlockExtMap) FindHighestLogical(hash common.Hash, number uint64) *BlockExt
func (*BlockExtMap) GetHasVoteWithoutBlock ¶
func (bm *BlockExtMap) GetHasVoteWithoutBlock(highest uint64) []*HashNumberBits
func (*BlockExtMap) GetSubChainUnExecuted ¶
func (bm *BlockExtMap) GetSubChainUnExecuted() []*BlockExt
func (*BlockExtMap) GetSubChainWithTwoThirdVotes ¶
func (bm *BlockExtMap) GetSubChainWithTwoThirdVotes(hash common.Hash, number uint64) []*BlockExt
func (*BlockExtMap) GetWithoutTwoThirdVotes ¶
func (bm *BlockExtMap) GetWithoutTwoThirdVotes(highest uint64) []*HashNumberBits
func (*BlockExtMap) Len ¶
func (bm *BlockExtMap) Len() int
func (*BlockExtMap) RemoveBlock ¶
func (bm *BlockExtMap) RemoveBlock(block *BlockExt)
func (*BlockExtMap) Total ¶
func (bm *BlockExtMap) Total() int
type BlockExtra ¶
type BlockExtra struct { Prepare []*prepareVote ViewChange *viewChange ViewChangeVotes []*viewChangeVote }
type Breakpoint ¶
type Breakpoint interface { PrepareBP() PrepareBP ViewChangeBP() ViewChangeBP InternalBP() InternalBP SyncBlockBP() SyncBlockBP }
Breakpoint is help resolve cbft consensus state Self implement breakpoint, watch all state about cbft
type Cbft ¶
type Cbft struct { RoundState // contains filtered or unexported fields }
func New ¶
func New(config *params.CbftConfig, eventMux *event.TypeMux, ctx *node.ServiceContext) *Cbft
New creates a concurrent BFT consensus engine
func (*Cbft) APIs ¶
func (cbft *Cbft) APIs(chain consensus.ChainReader) []rpc.API
APIs implements consensus.Engine, returning the user facing RPC API to allow controlling the signer voting.
func (*Cbft) AcceptPrepareBlock ¶
func (cbft *Cbft) AcceptPrepareBlock(request *prepareBlock) AcceptStatus
func (*Cbft) AcceptPrepareVote ¶
func (cbft *Cbft) AcceptPrepareVote(vote *prepareVote) AcceptStatus
func (*Cbft) AddJournal ¶
func (*Cbft) AddPrepareBlock ¶
func (*Cbft) AddProcessingVote ¶
func (*Cbft) AgreeViewChange ¶
func (*Cbft) Author ¶
Author implements consensus.Engine, returning the Ethereum address recovered from the signature in the header's extra-data section.
func (*Cbft) CalcBlockDeadline ¶
func (*Cbft) CalcNextBlockTime ¶
func (*Cbft) CheckConsensusNode ¶
CheckConsensusNode check if the nodeID is a consensus node.
func (*Cbft) ClearChildren ¶
func (*Cbft) ClearPending ¶
func (cbft *Cbft) ClearPending()
func (*Cbft) ClearViewChange ¶
func (cbft *Cbft) ClearViewChange()
func (*Cbft) Close ¶
Close implements consensus.Engine. It's a noop for cbft as there is are no background threads.
func (*Cbft) CommitBlockBP ¶
func (*Cbft) ConsensusNodes ¶
ConsensusNodes returns all consensus nodes.
func (*Cbft) CurrentBlock ¶
func (*Cbft) FastSyncCommitHead ¶
func (*Cbft) Finalize ¶
func (cbft *Cbft) Finalize(chain consensus.ChainReader, header *types.Header, state *state.StateDB, txs []*types.Transaction, receipts []*types.Receipt) (*types.Block, error)
Finalize implements consensus.Engine, no block rewards given, and returns the final block.
func (*Cbft) GetBlockWithoutLock ¶
func (*Cbft) HadSendViewChange ¶
func (*Cbft) HasTwoThirdsMajorityViewChangeVotes ¶
func (*Cbft) HighestConfirmedBlock ¶
HighestConfirmedBlock returns the cbft.highestConfirmed.block.
func (*Cbft) HighestLogicalBlock ¶
HighestLogicalBlock returns the cbft.highestLogical.block.
func (*Cbft) IsConsensusNode ¶
IsConsensusNode check if local is a consensus node.
func (*Cbft) IsSignedBySelf ¶
func (*Cbft) NextBaseBlock ¶
func (*Cbft) OnBaseBlock ¶
func (*Cbft) OnConfirmedPrepareBlock ¶
Sync confirmed prepare prepareVotes, not sync when local node has enough prepare prepareVotes
func (*Cbft) OnExecutedBlock ¶
func (cbft *Cbft) OnExecutedBlock(bs *ExecuteBlockStatus)
Receive executed block status, remove block if status is error If status is nil, broadcast itself PrepareVote about this block Reset highest logical (because receive block is order) Reset highest confirmed if this block had 2f+1 prepareVotes Flush Block (2f+1 ViewChangeVote and 2f+1 BaseBlock's PrepareVote
func (*Cbft) OnFastSyncCommitHead ¶
func (*Cbft) OnGetBlock ¶
func (*Cbft) OnGetBlockByHash ¶
func (*Cbft) OnGetHighestPrepareBlock ¶
func (*Cbft) OnGetPrepareBlock ¶
func (*Cbft) OnGetPrepareVote ¶
func (*Cbft) OnHasBlock ¶
func (*Cbft) OnHighestPrepareBlock ¶
func (*Cbft) OnNewBlock ¶
OnNewBlock is called by protocol handler when it received a new block by P2P.
func (*Cbft) OnNewPrepareBlock ¶
func (cbft *Cbft) OnNewPrepareBlock(nodeId discover.NodeID, request *prepareBlock, propagation bool) error
Receive prepare block from the other consensus node. Need check something ,such as validator index, address, view is equal local view , and last verify signature
func (*Cbft) OnPong ¶
OnPong is called by protocol handler when it received a new Pong message by P2P.
func (*Cbft) OnPrepareBlockHash ¶
func (*Cbft) OnPrepareVote ¶
OnBlockSignature is called by by protocol handler when it received a new block signature by P2P.
func (*Cbft) OnPrepareVotes ¶
func (*Cbft) OnSendViewChange ¶
func (cbft *Cbft) OnSendViewChange()
func (*Cbft) OnShouldSeal ¶
func (*Cbft) OnSyncBlock ¶
Sync block from p2p BlockNum is must higher current highest confirmed block If verify block success, cbft will change sync mode It don't process new PrepareBlock, PrepareVote, Viewchange, ViewchangeVote It stop sync mode when new view's parent block is in memory. Now it had catch up other peer
func (*Cbft) OnViewChange ¶
Receive view from other nodes Need verify timestamp , signature, promise highest confirmed block
func (*Cbft) OnViewChangeTimeout ¶
func (cbft *Cbft) OnViewChangeTimeout(view *viewChange)
func (*Cbft) OnViewChangeVote ¶
func (*Cbft) OnViewChangeVoteTimeout ¶
func (cbft *Cbft) OnViewChangeVoteTimeout(view *viewChangeVote)
Current view change timeout Need reset view
func (*Cbft) Prepare ¶
Prepare implements consensus.Engine, preparing all the consensus fields of the header for running the transactions on top.
func (*Cbft) ReceivePeerMsg ¶
func (*Cbft) Seal ¶
func (cbft *Cbft) Seal(chain consensus.ChainReader, block *types.Block, sealResultCh chan<- *types.Block, stopCh <-chan struct{}) error
to sign the block, and store the sign to header.Extra[32:], send the sign to chanel to broadcast to other consensus nodes
func (*Cbft) SetBlockChainCache ¶
func (cbft *Cbft) SetBlockChainCache(blockChainCache *core.BlockChainCache)
func (*Cbft) SetBreakpoint ¶
func (*Cbft) SetLocalHighestPrepareNum ¶
func (*Cbft) SetPrivateKey ¶
func (cbft *Cbft) SetPrivateKey(privateKey *ecdsa.PrivateKey)
SetPrivateKey sets local's private key by the backend.go
func (*Cbft) ShouldSeal ¶
ShouldSeal checks if it's local's turn to package new block at current time.
func (*Cbft) VerifyAndViewChange ¶
func (*Cbft) VerifyHeader ¶
VerifyHeader checks whether a header conforms to the consensus rules.
func (*Cbft) VerifyHeaders ¶
func (cbft *Cbft) VerifyHeaders(chain consensus.ChainReader, headers []*types.Header, seals []bool) (chan<- struct{}, <-chan error)
VerifyHeaders is similar to VerifyHeader, but verifies a batch of headers. The method returns a quit channel to abort the operations and a results channel to retrieve the async verifications (the order is that of the input slice).
func (*Cbft) VerifySeal ¶
VerifySeal implements consensus.Engine, checking whether the signature contained in the header satisfies the consensus protocol requirements.
type ConsensusMsg ¶
type Context ¶
type Context struct { //TraceID represents globally unique ID of the trace, such view's timestamp TraceID uint64 `json:"trace_id"` // SpanID represents span ID that must be unique within its trace, such as peerID, blockNum, baseBlock // but does not have to be globally unique. SpanID string `json:"span_id"` // ParentID refers to the ID of the parent span. // Should be "" if the current span is a root span. ParentID string `json:"parent_id"` // Log type such as "state", "stat" Flags byte `json:"flags"` //message signer Creator string `json:"creator"` //local node Processor string `json:"processor"` }
type DuplicatePrepareVoteEvidence ¶
type DuplicatePrepareVoteEvidence struct { VoteA *prepareVote VoteB *prepareVote }
Evidence A.Number == B.Number but A.Hash != B.Hash
func (DuplicatePrepareVoteEvidence) Address ¶
func (d DuplicatePrepareVoteEvidence) Address() common.Address
func (DuplicatePrepareVoteEvidence) BlockNumber ¶
func (d DuplicatePrepareVoteEvidence) BlockNumber() uint64
func (DuplicatePrepareVoteEvidence) Equal ¶
func (d DuplicatePrepareVoteEvidence) Equal(ev Evidence) bool
func (DuplicatePrepareVoteEvidence) Error ¶
func (d DuplicatePrepareVoteEvidence) Error() string
func (DuplicatePrepareVoteEvidence) Hash ¶
func (d DuplicatePrepareVoteEvidence) Hash() []byte
func (DuplicatePrepareVoteEvidence) Validate ¶
func (d DuplicatePrepareVoteEvidence) Validate() error
type DuplicateViewChangeVoteEvidence ¶
type DuplicateViewChangeVoteEvidence struct { VoteA *viewChangeVote VoteB *viewChangeVote }
Evidence A.BlockNum == B.BlockNum but A.BlockHash != B.BlockHash
func (DuplicateViewChangeVoteEvidence) Address ¶
func (d DuplicateViewChangeVoteEvidence) Address() common.Address
func (DuplicateViewChangeVoteEvidence) BlockNumber ¶
func (d DuplicateViewChangeVoteEvidence) BlockNumber() uint64
func (DuplicateViewChangeVoteEvidence) Equal ¶
func (d DuplicateViewChangeVoteEvidence) Equal(ev Evidence) bool
func (DuplicateViewChangeVoteEvidence) Error ¶
func (d DuplicateViewChangeVoteEvidence) Error() string
func (DuplicateViewChangeVoteEvidence) Hash ¶
func (d DuplicateViewChangeVoteEvidence) Hash() []byte
func (DuplicateViewChangeVoteEvidence) Validate ¶
func (d DuplicateViewChangeVoteEvidence) Validate() error
type EvidenceData ¶
type EvidenceData struct { DP []*DuplicatePrepareVoteEvidence `json:"duplicate_prepare"` DV []*DuplicateViewChangeVoteEvidence `json:"duplicate_viewchange"` TV []*TimestampViewChangeVoteEvidence `json:"timestamp_viewchange"` }
func ClassifyEvidence ¶
func ClassifyEvidence(evds []Evidence) *EvidenceData
func NewEvidenceData ¶
func NewEvidenceData() *EvidenceData
type EvidencePool ¶
type EvidencePool struct {
// contains filtered or unexported fields
}
func NewEvidencePool ¶
func NewEvidencePool(path string) (*EvidencePool, error)
func (*EvidencePool) AddPrepareVote ¶
func (ev *EvidencePool) AddPrepareVote(p *prepareVote) error
func (*EvidencePool) AddViewChangeVote ¶
func (ev *EvidencePool) AddViewChangeVote(v *viewChangeVote) error
func (*EvidencePool) Clear ¶
func (ev *EvidencePool) Clear(timestamp, blockNum uint64)
func (*EvidencePool) Close ¶
func (ev *EvidencePool) Close()
func (*EvidencePool) Evidences ¶
func (ev *EvidencePool) Evidences() []Evidence
type ExecuteBlockStatus ¶
type ExecuteBlockStatus struct {
// contains filtered or unexported fields
}
type HashNumberBits ¶
type HashNumberBits struct {
// contains filtered or unexported fields
}
type IWALDatabase ¶
type InnerAgency ¶
type InnerAgency struct { Agency // contains filtered or unexported fields }
func (*InnerAgency) GetLastNumber ¶
func (ia *InnerAgency) GetLastNumber(blockNumber uint64) uint64
func (*InnerAgency) GetValidator ¶
func (ia *InnerAgency) GetValidator(blockNumber uint64) (v *Validators, err error)
func (*InnerAgency) IsCandidateNode ¶
func (ia *InnerAgency) IsCandidateNode(nodeID discover.NodeID) bool
func (*InnerAgency) Sign ¶
func (ia *InnerAgency) Sign(interface{}) error
func (*InnerAgency) VerifySign ¶
func (ia *InnerAgency) VerifySign(interface{}) error
type InternalBP ¶
type InternalBP interface { ExecuteBlock(ctx context.Context, hash common.Hash, number uint64, timestamp uint64, elapse time.Duration) InvalidBlock(ctx context.Context, hash common.Hash, number uint64, timestamp uint64, err error) ForkedResetTxPool(ctx context.Context, newHeader *types.Header, injectBlock types.Blocks, elapse time.Duration, cbft *Cbft) ResetTxPool(ctx context.Context, ext *BlockExt, elapse time.Duration, cbft *Cbft) NewConfirmedBlock(ctx context.Context, ext *BlockExt, cbft *Cbft) NewLogicalBlock(ctx context.Context, ext *BlockExt, cbft *Cbft) NewRootBlock(ctx context.Context, ext *BlockExt, cbft *Cbft) NewHighestConfirmedBlock(ctx context.Context, ext *BlockExt, cbft *Cbft) NewHighestLogicalBlock(ctx context.Context, ext *BlockExt, cbft *Cbft) NewHighestRootBlock(ctx context.Context, ext *BlockExt, cbft *Cbft) SwitchView(ctx context.Context, view *viewChange, cbft *Cbft) Seal(ctx context.Context, ext *BlockExt, cbft *Cbft) StoreBlock(ctx context.Context, ext *BlockExt, cbft *Cbft) }
type JournalMessage ¶
type JournalMessageCbftStatusData ¶
type JournalMessageCbftStatusData struct { Timestamp uint64 Data *MsgInfoCbftStatusData }
type JournalMessageConfirmedPrepareBlock ¶
type JournalMessageConfirmedPrepareBlock struct { Timestamp uint64 Data *MsgInfoConfirmedPrepareBlock }
type JournalMessageGetHighestPrepareBlock ¶
type JournalMessageGetHighestPrepareBlock struct { Timestamp uint64 Data *MsgInfoGetHighestPrepareBlock }
type JournalMessageGetPrepareBlock ¶
type JournalMessageGetPrepareBlock struct { Timestamp uint64 Data *MsgInfoGetPrepareBlock }
type JournalMessageGetPrepareVote ¶
type JournalMessageGetPrepareVote struct { Timestamp uint64 Data *MsgInfoGetPrepareVote }
type JournalMessageHighestPrepareBlock ¶
type JournalMessageHighestPrepareBlock struct { Timestamp uint64 Data *MsgInfoHighestPrepareBlock }
type JournalMessagePrepareBlock ¶
type JournalMessagePrepareBlock struct { Timestamp uint64 Data *MsgInfoPrepareBlock }
type JournalMessagePrepareBlockHash ¶
type JournalMessagePrepareBlockHash struct { Timestamp uint64 Data *MsgInfoPrepareBlockHash }
type JournalMessagePrepareVote ¶
type JournalMessagePrepareVote struct { Timestamp uint64 Data *MsgInfoPrepareVote }
type JournalMessagePrepareVotes ¶
type JournalMessagePrepareVotes struct { Timestamp uint64 Data *MsgInfoPrepareVotes }
type JournalMessageViewChange ¶
type JournalMessageViewChange struct { Timestamp uint64 Data *MsgInfoViewChange }
type JournalMessageViewChangeVote ¶
type JournalMessageViewChangeVote struct { Timestamp uint64 Data *MsgInfoViewChangeVote }
type LogRecord ¶
type LogRecord struct { Timestamp int64 `json:"timestamp"` Log interface{} `json:"log"` }
type MsgInfoCbftStatusData ¶
type MsgInfoGetPrepareBlock ¶
type MsgInfoGetPrepareVote ¶
type MsgInfoPrepareBlock ¶
type MsgInfoPrepareBlockHash ¶
type MsgInfoPrepareVote ¶
type MsgInfoPrepareVotes ¶
type MsgInfoViewChange ¶
type MsgInfoViewChangeVote ¶
type MsgPackage ¶
type MsgPackage struct {
// contains filtered or unexported fields
}
type NumberOrderPrepare ¶
type NumberOrderPrepare []*prepareVote
func (*NumberOrderPrepare) Add ¶
func (vt *NumberOrderPrepare) Add(v *prepareVote) error
func (NumberOrderPrepare) Len ¶
func (vt NumberOrderPrepare) Len() int
func (NumberOrderPrepare) Less ¶
func (vt NumberOrderPrepare) Less(i, j int) bool
func (*NumberOrderPrepare) Remove ¶
func (vt *NumberOrderPrepare) Remove(blockNum uint64)
func (NumberOrderPrepare) Swap ¶
func (vt NumberOrderPrepare) Swap(i, j int)
type NumberOrderViewChange ¶
type NumberOrderViewChange []*viewChangeVote
func (*NumberOrderViewChange) Add ¶
func (vt *NumberOrderViewChange) Add(v *viewChangeVote) error
func (NumberOrderViewChange) Len ¶
func (vt NumberOrderViewChange) Len() int
func (NumberOrderViewChange) Less ¶
func (vt NumberOrderViewChange) Less(i, j int) bool
func (*NumberOrderViewChange) Remove ¶
func (vt *NumberOrderViewChange) Remove(blockNum uint64)
func (NumberOrderViewChange) Swap ¶
func (vt NumberOrderViewChange) Swap(i, j int)
type PendingBlock ¶
func (PendingBlock) Add ¶
func (pb PendingBlock) Add(hash common.Hash, ext *prepareBlock)
func (*PendingBlock) Clear ¶
func (pb *PendingBlock) Clear()
func (PendingBlock) String ¶
func (pb PendingBlock) String() string
type PendingVote ¶
func (PendingVote) Add ¶
func (pv PendingVote) Add(hash common.Hash, vote *prepareVote)
func (*PendingVote) Clear ¶
func (pv *PendingVote) Clear()
func (PendingVote) String ¶
func (pv PendingVote) String() string
type PrepareBP ¶
type PrepareBP interface { CommitBlock(ctx context.Context, block *types.Block, txs int, gasUsed uint64, elapse time.Duration, cbft *Cbft) SendBlock(ctx context.Context, block *prepareBlock, cbft *Cbft) ReceiveBlock(ctx context.Context, block *prepareBlock, cbft *Cbft) ReceiveVote(ctx context.Context, block *prepareVote, cbft *Cbft) //accept block AcceptBlock(ctx context.Context, block *prepareBlock, cbft *Cbft) CacheBlock(ctx context.Context, block *prepareBlock, cbft *Cbft) DiscardBlock(ctx context.Context, block *prepareBlock, cbft *Cbft) //accept block AcceptVote(ctx context.Context, block *prepareVote, cbft *Cbft) CacheVote(ctx context.Context, block *prepareVote, cbft *Cbft) DiscardVote(ctx context.Context, block *prepareVote, cbft *Cbft) SendPrepareVote(ctx context.Context, ext *prepareVote, cbft *Cbft) InvalidBlock(ctx context.Context, block *prepareBlock, err error, cbft *Cbft) InvalidVote(ctx context.Context, block *prepareVote, err error, cbft *Cbft) InvalidViewChangeVote(ctx context.Context, block *prepareBlock, err error, cbft *Cbft) TwoThirdVotes(ctx context.Context, ext *prepareVote, cbft *Cbft) }
type PrepareEvidence ¶
type PrepareEvidence map[common.Address]NumberOrderPrepare
func (PrepareEvidence) Add ¶
func (vt PrepareEvidence) Add(v *prepareVote) error
func (PrepareEvidence) Clear ¶
func (vt PrepareEvidence) Clear(number uint64)
type ProcessingVote ¶
func (ProcessingVote) Add ¶
func (pv ProcessingVote) Add(hash common.Hash, nodeId discover.NodeID, vote *prepareVote)
func (*ProcessingVote) Clear ¶
func (pv *ProcessingVote) Clear()
func (ProcessingVote) String ¶
func (pv ProcessingVote) String() string
type ProducerBlocks ¶
type ProducerBlocks struct {
// contains filtered or unexported fields
}
func NewProducerBlocks ¶
func NewProducerBlocks(author discover.NodeID, blockNum uint64) *ProducerBlocks
func (*ProducerBlocks) AddBlock ¶
func (pb *ProducerBlocks) AddBlock(block *types.Block)
func (*ProducerBlocks) Author ¶
func (pb *ProducerBlocks) Author() discover.NodeID
func (*ProducerBlocks) ExistBlock ¶
func (pb *ProducerBlocks) ExistBlock(block *types.Block) bool
func (*ProducerBlocks) Len ¶
func (pb *ProducerBlocks) Len() int
func (*ProducerBlocks) MaxSequenceBlock ¶
func (pb *ProducerBlocks) MaxSequenceBlock() *types.Block
func (*ProducerBlocks) MaxSequenceBlockNum ¶
func (pb *ProducerBlocks) MaxSequenceBlockNum() uint64
func (*ProducerBlocks) SetAuthor ¶
func (pb *ProducerBlocks) SetAuthor(author discover.NodeID)
func (ProducerBlocks) String ¶
func (pb ProducerBlocks) String() string
type RoundState ¶
type RoundState struct {
// contains filtered or unexported fields
}
func (RoundState) String ¶
func (rs RoundState) String() string
type StaticAgency ¶
type StaticAgency struct { Agency // contains filtered or unexported fields }
func (*StaticAgency) GetLastNumber ¶
func (d *StaticAgency) GetLastNumber(blockNumber uint64) uint64
func (*StaticAgency) GetValidator ¶
func (d *StaticAgency) GetValidator(uint64) (*Validators, error)
func (*StaticAgency) IsCandidateNode ¶
func (d *StaticAgency) IsCandidateNode(nodeID discover.NodeID) bool
func (*StaticAgency) Sign ¶
func (d *StaticAgency) Sign(interface{}) error
func (*StaticAgency) VerifySign ¶
func (d *StaticAgency) VerifySign(interface{}) error
type SyncBlockBP ¶
type TimeOrderViewChange ¶
type TimeOrderViewChange []*viewChangeVote
func (*TimeOrderViewChange) Add ¶
func (vt *TimeOrderViewChange) Add(v *viewChangeVote) error
func (TimeOrderViewChange) Len ¶
func (vt TimeOrderViewChange) Len() int
func (TimeOrderViewChange) Less ¶
func (vt TimeOrderViewChange) Less(i, j int) bool
func (*TimeOrderViewChange) Remove ¶
func (vt *TimeOrderViewChange) Remove(timestamp uint64)
func (TimeOrderViewChange) Swap ¶
func (vt TimeOrderViewChange) Swap(i, j int)
type TimestampViewChangeVoteEvidence ¶
type TimestampViewChangeVoteEvidence struct { VoteA *viewChangeVote VoteB *viewChangeVote }
Evidence A.Timestamp < B.Timestamp but A.BlockNum > B.BlockNum
func (TimestampViewChangeVoteEvidence) Address ¶
func (d TimestampViewChangeVoteEvidence) Address() common.Address
func (TimestampViewChangeVoteEvidence) BlockNumber ¶
func (d TimestampViewChangeVoteEvidence) BlockNumber() uint64
func (TimestampViewChangeVoteEvidence) Equal ¶
func (d TimestampViewChangeVoteEvidence) Equal(ev Evidence) bool
func (TimestampViewChangeVoteEvidence) Error ¶
func (d TimestampViewChangeVoteEvidence) Error() string
func (TimestampViewChangeVoteEvidence) Hash ¶
func (d TimestampViewChangeVoteEvidence) Hash() []byte
func (TimestampViewChangeVoteEvidence) Validate ¶
func (d TimestampViewChangeVoteEvidence) Validate() error
type ValidateNode ¶
type ValidateNode struct { Index int `json:"index"` Address common.Address `json:"-"` PubKey *ecdsa.PublicKey }
func (*ValidateNode) String ¶
func (vn *ValidateNode) String() string
func (*ValidateNode) Verify ¶
func (vn *ValidateNode) Verify(data, sign []byte) bool
type ValidateNodeMap ¶
type ValidateNodeMap map[discover.NodeID]*ValidateNode
func (ValidateNodeMap) String ¶
func (vnm ValidateNodeMap) String() string
type Validators ¶
type Validators struct { Nodes ValidateNodeMap `json:"validateNodes"` ValidBlockNumber uint64 `json:"-"` }
func (*Validators) AddressIndex ¶
func (vs *Validators) AddressIndex(addr common.Address) (*ValidateNode, error)
func (*Validators) Equal ¶
func (vs *Validators) Equal(rsh *Validators) bool
func (*Validators) Len ¶
func (vs *Validators) Len() int
func (*Validators) NodeIndex ¶
func (vs *Validators) NodeIndex(id discover.NodeID) (*ValidateNode, error)
func (*Validators) NodeIndexAddress ¶
func (vs *Validators) NodeIndexAddress(id discover.NodeID) (*ValidateNode, error)
func (*Validators) NodeList ¶
func (vs *Validators) NodeList() []discover.NodeID
func (*Validators) String ¶
func (vs *Validators) String() string
type ViewChangeBP ¶
type ViewChangeBP interface { SendViewChange(ctx context.Context, view *viewChange, cbft *Cbft) ReceiveViewChange(ctx context.Context, view *viewChange, cbft *Cbft) ReceiveViewChangeVote(ctx context.Context, view *viewChangeVote, cbft *Cbft) InvalidViewChange(ctx context.Context, view *viewChange, err error, cbft *Cbft) InvalidViewChangeVote(ctx context.Context, view *viewChangeVote, err error, cbft *Cbft) InvalidViewChangeBlock(ctx context.Context, view *viewChange, cbft *Cbft) TwoThirdViewChangeVotes(ctx context.Context, view *viewChange, votes ViewChangeVotes, cbft *Cbft) SendViewChangeVote(ctx context.Context, view *viewChangeVote, cbft *Cbft) ViewChangeTimeout(ctx context.Context, view *viewChange, cbft *Cbft) }
type ViewChangeMessage ¶
type ViewChangeMeta ¶
type ViewChangeVotes ¶
func (ViewChangeVotes) Bits ¶
func (vv ViewChangeVotes) Bits(cnt int) string
func (ViewChangeVotes) MarshalJSON ¶
func (vv ViewChangeVotes) MarshalJSON() ([]byte, error)
func (ViewChangeVotes) String ¶
func (vv ViewChangeVotes) String() string
func (ViewChangeVotes) UnmarshalJSON ¶
func (vv ViewChangeVotes) UnmarshalJSON(b []byte) error
type ViewNumberEvidence ¶
type ViewNumberEvidence map[common.Address]NumberOrderViewChange
func (ViewNumberEvidence) Add ¶
func (vt ViewNumberEvidence) Add(v *viewChangeVote) error
func (ViewNumberEvidence) Clear ¶
func (vt ViewNumberEvidence) Clear(number uint64)
type ViewTimeEvidence ¶
type ViewTimeEvidence map[common.Address]TimeOrderViewChange
func (ViewTimeEvidence) Add ¶
func (vt ViewTimeEvidence) Add(v *viewChangeVote) error
func (ViewTimeEvidence) Clear ¶
func (vt ViewTimeEvidence) Clear(timestamp uint64)
type WALDatabase ¶
type WALDatabase struct {
// contains filtered or unexported fields
}
func (*WALDatabase) Close ¶
func (db *WALDatabase) Close()
func (*WALDatabase) Delete ¶
func (db *WALDatabase) Delete(key []byte) error
Delete deletes the key from the queue and database
func (*WALDatabase) Get ¶
func (db *WALDatabase) Get(key []byte) ([]byte, error)
Get returns the given key if it's present.
func (*WALDatabase) Path ¶
func (db *WALDatabase) Path() string
Path returns the path to the database directory.
func (*WALDatabase) Put ¶
func (db *WALDatabase) Put(key []byte, value []byte, wo *opt.WriteOptions) error
Put puts the given key / value to the queue
type Wal ¶
type WriterWrapper ¶
type WriterWrapper struct {
// contains filtered or unexported fields
}
func NewWriterWrapper ¶
func NewWriterWrapper(file *os.File, bufferLimitSize int) *WriterWrapper
func (*WriterWrapper) Close ¶
func (w *WriterWrapper) Close() (err error)
func (*WriterWrapper) Flush ¶
func (w *WriterWrapper) Flush() (err error)
func (*WriterWrapper) FlushAndClose ¶
func (w *WriterWrapper) FlushAndClose() (err error)