Documentation ¶
Index ¶
- Constants
- Variables
- type ChangeView
- type ConsensusContext
- func (cxt *ConsensusContext) ChangeView(viewNum byte)
- func (cxt *ConsensusContext) GetSignaturesCount() (count int)
- func (cxt *ConsensusContext) GetStateDetail() string
- func (cxt *ConsensusContext) M() int
- func (cxt *ConsensusContext) MakeChangeView() *msg.ConsensusPayload
- func (cxt *ConsensusContext) MakeHeader() *ledger.Block
- func (cxt *ConsensusContext) MakePayload(message ConsensusMessage) *msg.ConsensusPayload
- func (cxt *ConsensusContext) MakePrepareRequest() *msg.ConsensusPayload
- func (cxt *ConsensusContext) MakePrepareResponse(signature []byte) *msg.ConsensusPayload
- func (cxt *ConsensusContext) Reset(client cl.Client, localNode net.Neter)
- type ConsensusMessage
- type ConsensusMessageData
- type ConsensusMessageType
- type ConsensusState
- type DbftService
- func (ds *DbftService) BlockPersistCompleted(v interface{})
- func (ds *DbftService) ChangeViewReceived(payload *msg.ConsensusPayload, message *ChangeView)
- func (ds *DbftService) CheckExpectedView(viewNumber byte)
- func (ds *DbftService) CheckPolicy(transaction *tx.Transaction) error
- func (ds *DbftService) CheckSignatures() error
- func (ds *DbftService) CreateBookkeepingTransaction(txnFeeOutputs []*tx.TxOutput, nonce uint64) *tx.Transaction
- func (ds *DbftService) GetUnverifiedTxs(txs []*tx.Transaction) []*tx.Transaction
- func (ds *DbftService) Halt() error
- func (ds *DbftService) InitializeConsensus(viewNum byte) error
- func (ds *DbftService) LocalNodeNewInventory(v interface{})
- func (ds *DbftService) NewConsensusPayload(payload *msg.ConsensusPayload)
- func (ds *DbftService) PrepareRequestReceived(payload *msg.ConsensusPayload, message *PrepareRequest)
- func (ds *DbftService) PrepareResponseReceived(payload *msg.ConsensusPayload, message *PrepareResponse)
- func (ds *DbftService) RefreshPolicy()
- func (ds *DbftService) RequestChangeView()
- func (ds *DbftService) SignAndRelay(payload *msg.ConsensusPayload)
- func (ds *DbftService) Start() error
- func (ds *DbftService) Timeout()
- func (ds *DbftService) VerifyTxs(txs []*tx.Transaction) error
- type PrepareRequest
- type PrepareResponse
Constants ¶
View Source
const ContextVersion uint32 = 0
View Source
const (
MINGENBLOCKTIME = 6
)
Variables ¶
View Source
var GenBlockTime = (MINGENBLOCKTIME * time.Second)
Functions ¶
This section is empty.
Types ¶
type ChangeView ¶
type ChangeView struct { NewViewNumber byte // contains filtered or unexported fields }
func (*ChangeView) ConsensusMessageData ¶
func (cv *ChangeView) ConsensusMessageData() *ConsensusMessageData
func (*ChangeView) Deserialize ¶
func (cv *ChangeView) Deserialize(r io.Reader) error
read data to reader
func (*ChangeView) Type ¶
func (cv *ChangeView) Type() ConsensusMessageType
func (*ChangeView) ViewNumber ¶
func (cv *ChangeView) ViewNumber() byte
type ConsensusContext ¶
type ConsensusContext struct { State ConsensusState PrevHash Uint256 Height uint32 ViewNumber byte BookKeepers []*crypto.PubKey NextBookKeepers []*crypto.PubKey Owner *crypto.PubKey BookKeeperIndex int PrimaryIndex uint32 Timestamp uint32 Nonce uint64 NextBookKeeper Uint160 Transactions []*tx.Transaction Signatures [][]byte ExpectedView []byte // contains filtered or unexported fields }
func (*ConsensusContext) ChangeView ¶
func (cxt *ConsensusContext) ChangeView(viewNum byte)
func (*ConsensusContext) GetSignaturesCount ¶
func (cxt *ConsensusContext) GetSignaturesCount() (count int)
func (*ConsensusContext) GetStateDetail ¶
func (cxt *ConsensusContext) GetStateDetail() string
func (*ConsensusContext) M ¶
func (cxt *ConsensusContext) M() int
func (*ConsensusContext) MakeChangeView ¶
func (cxt *ConsensusContext) MakeChangeView() *msg.ConsensusPayload
func (*ConsensusContext) MakeHeader ¶
func (cxt *ConsensusContext) MakeHeader() *ledger.Block
func (*ConsensusContext) MakePayload ¶
func (cxt *ConsensusContext) MakePayload(message ConsensusMessage) *msg.ConsensusPayload
func (*ConsensusContext) MakePrepareRequest ¶
func (cxt *ConsensusContext) MakePrepareRequest() *msg.ConsensusPayload
func (*ConsensusContext) MakePrepareResponse ¶
func (cxt *ConsensusContext) MakePrepareResponse(signature []byte) *msg.ConsensusPayload
type ConsensusMessage ¶
type ConsensusMessage interface { serialization.SerializableData 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) Deserialize ¶
func (cd *ConsensusMessageData) Deserialize(r io.Reader) error
read data to reader
func (*ConsensusMessageData) Serialize ¶
func (cd *ConsensusMessageData) Serialize(w io.Writer)
type ConsensusMessageType ¶
type ConsensusMessageType byte
const ( ChangeViewMsg ConsensusMessageType = 0x00 PrepareRequestMsg ConsensusMessageType = 0x20 PrepareResponseMsg ConsensusMessageType = 0x21 )
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) ChangeViewReceived ¶
func (ds *DbftService) ChangeViewReceived(payload *msg.ConsensusPayload, message *ChangeView)
func (*DbftService) CheckExpectedView ¶
func (ds *DbftService) CheckExpectedView(viewNumber byte)
func (*DbftService) CheckPolicy ¶
func (ds *DbftService) CheckPolicy(transaction *tx.Transaction) error
func (*DbftService) CheckSignatures ¶
func (ds *DbftService) CheckSignatures() error
check signature and save block
func (*DbftService) CreateBookkeepingTransaction ¶
func (ds *DbftService) CreateBookkeepingTransaction(txnFeeOutputs []*tx.TxOutput, nonce uint64) *tx.Transaction
func (*DbftService) GetUnverifiedTxs ¶
func (ds *DbftService) GetUnverifiedTxs(txs []*tx.Transaction) []*tx.Transaction
func (*DbftService) Halt ¶
func (ds *DbftService) Halt() error
func (*DbftService) InitializeConsensus ¶
func (ds *DbftService) InitializeConsensus(viewNum byte) error
func (*DbftService) LocalNodeNewInventory ¶
func (ds *DbftService) LocalNodeNewInventory(v interface{})
func (*DbftService) NewConsensusPayload ¶
func (ds *DbftService) NewConsensusPayload(payload *msg.ConsensusPayload)
func (*DbftService) PrepareRequestReceived ¶
func (ds *DbftService) PrepareRequestReceived(payload *msg.ConsensusPayload, message *PrepareRequest)
func (*DbftService) PrepareResponseReceived ¶
func (ds *DbftService) PrepareResponseReceived(payload *msg.ConsensusPayload, message *PrepareResponse)
func (*DbftService) RefreshPolicy ¶
func (ds *DbftService) RefreshPolicy()
func (*DbftService) RequestChangeView ¶
func (ds *DbftService) RequestChangeView()
func (*DbftService) SignAndRelay ¶
func (ds *DbftService) SignAndRelay(payload *msg.ConsensusPayload)
func (*DbftService) Start ¶
func (ds *DbftService) Start() error
func (*DbftService) Timeout ¶
func (ds *DbftService) Timeout()
func (*DbftService) VerifyTxs ¶
func (ds *DbftService) VerifyTxs(txs []*tx.Transaction) error
type PrepareRequest ¶
type PrepareRequest struct { Nonce uint64 NextBookKeeper common.Uint160 Transactions []*tx.Transaction Signature []byte // contains filtered or unexported fields }
func (*PrepareRequest) ConsensusMessageData ¶
func (pr *PrepareRequest) ConsensusMessageData() *ConsensusMessageData
func (*PrepareRequest) Deserialize ¶
func (pr *PrepareRequest) Deserialize(r io.Reader) error
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) Deserialize ¶
func (pres *PrepareResponse) Deserialize(r io.Reader) error
func (*PrepareResponse) Type ¶
func (pres *PrepareResponse) Type() ConsensusMessageType
func (*PrepareResponse) ViewNumber ¶
func (pres *PrepareResponse) ViewNumber() byte
Click to show internal directories.
Click to hide internal directories.