Documentation ¶
Index ¶
- Constants
- type BlockSignatures
- func (self *BlockSignatures) ConsensusMessageData() *ConsensusMessageData
- func (self *BlockSignatures) Deserialization(source *common.ZeroCopySource) error
- func (self *BlockSignatures) Serialization(sink *common.ZeroCopySink)
- func (self *BlockSignatures) Type() ConsensusMessageType
- func (self *BlockSignatures) ViewNumber() byte
- type ChangeView
- type ConsensusContext
- func (ctx *ConsensusContext) ChangeView(viewNum byte)
- func (ctx *ConsensusContext) GetSignaturesCount() (count int)
- func (ctx *ConsensusContext) GetStateDetail() string
- func (ctx *ConsensusContext) M() int
- func (ctx *ConsensusContext) MakeBlockSignatures(signatures []SignaturesData) *msg.ConsensusPayload
- func (ctx *ConsensusContext) MakeChangeView() *msg.ConsensusPayload
- func (ctx *ConsensusContext) MakeHeader() *types.Block
- func (ctx *ConsensusContext) MakePayload(message ConsensusMessage) *msg.ConsensusPayload
- func (ctx *ConsensusContext) MakePrepareRequest() *msg.ConsensusPayload
- func (ctx *ConsensusContext) MakePrepareResponse(signature []byte) *msg.ConsensusPayload
- func (ctx *ConsensusContext) Reset(bkAccount *account.Account)
- type ConsensusMessage
- type ConsensusMessageData
- type ConsensusMessageType
- type ConsensusState
- type DbftService
- func (ds *DbftService) BlockPersistCompleted(v interface{})
- func (ds *DbftService) BlockSignaturesReceived(payload *p2pmsg.ConsensusPayload, message *BlockSignatures)
- func (ds *DbftService) ChangeViewReceived(payload *p2pmsg.ConsensusPayload, message *ChangeView)
- func (ds *DbftService) CheckExpectedView(viewNumber byte)
- func (ds *DbftService) CheckPolicy(transaction *types.Transaction) error
- func (ds *DbftService) CheckSignatures() error
- func (this *DbftService) GetPID() *actor.PID
- func (this *DbftService) Halt() error
- func (ds *DbftService) InitializeConsensus(viewNum byte) error
- func (ds *DbftService) NewConsensusPayload(payload *p2pmsg.ConsensusPayload)
- func (ds *DbftService) PrepareRequestReceived(payload *p2pmsg.ConsensusPayload, message *PrepareRequest)
- func (ds *DbftService) PrepareResponseReceived(payload *p2pmsg.ConsensusPayload, message *PrepareResponse)
- func (this *DbftService) Receive(context actor.Context)
- func (ds *DbftService) RefreshPolicy()
- func (ds *DbftService) RequestChangeView()
- func (ds *DbftService) SignAndRelay(payload *p2pmsg.ConsensusPayload)
- func (this *DbftService) Start() error
- func (ds *DbftService) Timeout()
- type PrepareRequest
- func (pr *PrepareRequest) ConsensusMessageData() *ConsensusMessageData
- func (pr *PrepareRequest) Deserialization(source *common.ZeroCopySource) error
- func (pr *PrepareRequest) Serialization(sink *common.ZeroCopySink)
- func (pr *PrepareRequest) Type() ConsensusMessageType
- func (pr *PrepareRequest) ViewNumber() byte
- type PrepareResponse
- func (pres *PrepareResponse) ConsensusMessageData() *ConsensusMessageData
- func (pres *PrepareResponse) Deserialization(source *common.ZeroCopySource) error
- func (pres *PrepareResponse) Serialization(sink *common.ZeroCopySink)
- func (pres *PrepareResponse) Type() ConsensusMessageType
- func (pres *PrepareResponse) ViewNumber() byte
- type SignaturesData
Constants ¶
View Source
const ContextVersion uint32 = 0
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BlockSignatures ¶
type BlockSignatures struct { Signatures []SignaturesData // contains filtered or unexported fields }
func (*BlockSignatures) ConsensusMessageData ¶
func (self *BlockSignatures) ConsensusMessageData() *ConsensusMessageData
func (*BlockSignatures) Deserialization ¶ added in v1.0.3
func (self *BlockSignatures) Deserialization(source *common.ZeroCopySource) error
func (*BlockSignatures) Serialization ¶ added in v1.0.3
func (self *BlockSignatures) Serialization(sink *common.ZeroCopySink)
func (*BlockSignatures) Type ¶
func (self *BlockSignatures) Type() ConsensusMessageType
func (*BlockSignatures) ViewNumber ¶
func (self *BlockSignatures) ViewNumber() byte
type ChangeView ¶
type ChangeView struct { NewViewNumber byte // contains filtered or unexported fields }
func (*ChangeView) ConsensusMessageData ¶
func (cv *ChangeView) ConsensusMessageData() *ConsensusMessageData
func (*ChangeView) Deserialization ¶ added in v1.0.3
func (cv *ChangeView) Deserialization(source *common.ZeroCopySource) error
read data to reader
func (*ChangeView) Serialization ¶ added in v1.0.3
func (cv *ChangeView) Serialization(sink *common.ZeroCopySink)
func (*ChangeView) Type ¶
func (cv *ChangeView) Type() ConsensusMessageType
func (*ChangeView) ViewNumber ¶
func (cv *ChangeView) ViewNumber() byte
type ConsensusContext ¶
type ConsensusContext struct { State ConsensusState PrevHash common.Uint256 Height uint32 ViewNumber byte Bookkeepers []keypair.PublicKey NextBookkeepers []keypair.PublicKey Owner keypair.PublicKey BookkeeperIndex int PrimaryIndex uint32 Timestamp uint32 Nonce uint64 NextBookkeeper common.Address Transactions []*types.Transaction Signatures [][]byte ExpectedView []byte // contains filtered or unexported fields }
func NewConsensusContext ¶
func NewConsensusContext() *ConsensusContext
func (*ConsensusContext) ChangeView ¶
func (ctx *ConsensusContext) ChangeView(viewNum byte)
func (*ConsensusContext) GetSignaturesCount ¶
func (ctx *ConsensusContext) GetSignaturesCount() (count int)
func (*ConsensusContext) GetStateDetail ¶
func (ctx *ConsensusContext) GetStateDetail() string
func (*ConsensusContext) M ¶
func (ctx *ConsensusContext) M() int
func (*ConsensusContext) MakeBlockSignatures ¶
func (ctx *ConsensusContext) MakeBlockSignatures(signatures []SignaturesData) *msg.ConsensusPayload
func (*ConsensusContext) MakeChangeView ¶
func (ctx *ConsensusContext) MakeChangeView() *msg.ConsensusPayload
func (*ConsensusContext) MakeHeader ¶
func (ctx *ConsensusContext) MakeHeader() *types.Block
func (*ConsensusContext) MakePayload ¶
func (ctx *ConsensusContext) MakePayload(message ConsensusMessage) *msg.ConsensusPayload
func (*ConsensusContext) MakePrepareRequest ¶
func (ctx *ConsensusContext) MakePrepareRequest() *msg.ConsensusPayload
func (*ConsensusContext) MakePrepareResponse ¶
func (ctx *ConsensusContext) MakePrepareResponse(signature []byte) *msg.ConsensusPayload
func (*ConsensusContext) Reset ¶
func (ctx *ConsensusContext) Reset(bkAccount *account.Account)
type ConsensusMessage ¶
type ConsensusMessage interface { Serialization(sink *common.ZeroCopySink) Deserialization(source *common.ZeroCopySource) error Type() ConsensusMessageType ViewNumber() byte ConsensusMessageData() *ConsensusMessageData }
func DeserializeMessage ¶
func DeserializeMessage(data []byte) (ConsensusMessage, error)
type ConsensusMessageData ¶
type ConsensusMessageData struct { Type ConsensusMessageType ViewNumber byte }
func (*ConsensusMessageData) Deserialization ¶ added in v1.0.3
func (cd *ConsensusMessageData) Deserialization(source *common.ZeroCopySource) error
read data to reader
func (*ConsensusMessageData) Serialization ¶ added in v1.0.3
func (cd *ConsensusMessageData) Serialization(sink *common.ZeroCopySink)
type ConsensusMessageType ¶
type ConsensusMessageType byte
const ( ChangeViewMsg ConsensusMessageType = 0x00 PrepareRequestMsg ConsensusMessageType = 0x20 PrepareResponseMsg ConsensusMessageType = 0x21 BlockSignaturesMsg ConsensusMessageType = 0x01 )
type ConsensusState ¶
type ConsensusState byte
const ( Initial ConsensusState = 0x00 Primary ConsensusState = 0x01 Backup ConsensusState = 0x02 RequestSent ConsensusState = 0x04 RequestReceived ConsensusState = 0x08 SignatureSent ConsensusState = 0x10 BlockGenerated ConsensusState = 0x20 )
func (ConsensusState) HasFlag ¶
func (state ConsensusState) HasFlag(flag ConsensusState) bool
type DbftService ¶
func NewDbftService ¶
func (*DbftService) BlockPersistCompleted ¶
func (ds *DbftService) BlockPersistCompleted(v interface{})
func (*DbftService) BlockSignaturesReceived ¶
func (ds *DbftService) BlockSignaturesReceived(payload *p2pmsg.ConsensusPayload, message *BlockSignatures)
func (*DbftService) ChangeViewReceived ¶
func (ds *DbftService) ChangeViewReceived(payload *p2pmsg.ConsensusPayload, message *ChangeView)
func (*DbftService) CheckExpectedView ¶
func (ds *DbftService) CheckExpectedView(viewNumber byte)
func (*DbftService) CheckPolicy ¶
func (ds *DbftService) CheckPolicy(transaction *types.Transaction) error
func (*DbftService) CheckSignatures ¶
func (ds *DbftService) CheckSignatures() error
func (*DbftService) GetPID ¶
func (this *DbftService) GetPID() *actor.PID
func (*DbftService) Halt ¶
func (this *DbftService) Halt() error
func (*DbftService) InitializeConsensus ¶
func (ds *DbftService) InitializeConsensus(viewNum byte) error
func (*DbftService) NewConsensusPayload ¶
func (ds *DbftService) NewConsensusPayload(payload *p2pmsg.ConsensusPayload)
func (*DbftService) PrepareRequestReceived ¶
func (ds *DbftService) PrepareRequestReceived(payload *p2pmsg.ConsensusPayload, message *PrepareRequest)
func (*DbftService) PrepareResponseReceived ¶
func (ds *DbftService) PrepareResponseReceived(payload *p2pmsg.ConsensusPayload, message *PrepareResponse)
func (*DbftService) Receive ¶
func (this *DbftService) Receive(context actor.Context)
func (*DbftService) RefreshPolicy ¶
func (ds *DbftService) RefreshPolicy()
func (*DbftService) RequestChangeView ¶
func (ds *DbftService) RequestChangeView()
func (*DbftService) SignAndRelay ¶
func (ds *DbftService) SignAndRelay(payload *p2pmsg.ConsensusPayload)
func (*DbftService) Start ¶
func (this *DbftService) Start() error
func (*DbftService) Timeout ¶
func (ds *DbftService) Timeout()
type PrepareRequest ¶
type PrepareRequest struct { Nonce uint64 NextBookkeeper common.Address Transactions []*types.Transaction Signature []byte // contains filtered or unexported fields }
func (*PrepareRequest) ConsensusMessageData ¶
func (pr *PrepareRequest) ConsensusMessageData() *ConsensusMessageData
func (*PrepareRequest) Deserialization ¶ added in v1.0.3
func (pr *PrepareRequest) Deserialization(source *common.ZeroCopySource) error
func (*PrepareRequest) Serialization ¶ added in v1.0.3
func (pr *PrepareRequest) Serialization(sink *common.ZeroCopySink)
func (*PrepareRequest) Type ¶
func (pr *PrepareRequest) Type() ConsensusMessageType
func (*PrepareRequest) ViewNumber ¶
func (pr *PrepareRequest) ViewNumber() byte
type PrepareResponse ¶
type PrepareResponse struct { Signature []byte // contains filtered or unexported fields }
func (*PrepareResponse) ConsensusMessageData ¶
func (pres *PrepareResponse) ConsensusMessageData() *ConsensusMessageData
func (*PrepareResponse) Deserialization ¶ added in v1.0.3
func (pres *PrepareResponse) Deserialization(source *common.ZeroCopySource) error
read data to reader
func (*PrepareResponse) Serialization ¶ added in v1.0.3
func (pres *PrepareResponse) Serialization(sink *common.ZeroCopySink)
func (*PrepareResponse) Type ¶
func (pres *PrepareResponse) Type() ConsensusMessageType
func (*PrepareResponse) ViewNumber ¶
func (pres *PrepareResponse) ViewNumber() byte
type SignaturesData ¶
Click to show internal directories.
Click to hide internal directories.