Documentation
¶
Index ¶
Constants ¶
View Source
const ( FlagHelloAck = 0x0001 FlagNodeNetwork = 0x0100 )
View Source
const ( ResponseCodeNone = ResponseCode(-1) ResponseCodeOK = ResponseCode(0) ResponseCodeRejected = ResponseCode(1) ResponseCodeBusy = ResponseCode(2) ResponseCodeMoreBlocks = ResponseCode(3) ResponseCodeNoMoreBlocks = ResponseCode(4) ResponseCodeSynced = ResponseCode(5) )
View Source
const ( MessageTypeHello = Type(1) MessageTypeHeartBeat = Type(2) MessageTypeTransactions = Type(3) MessageTypeQueryProposal = Type(4) MessageTypeProposal = Type(5) MessageTypeQueryVotes = Type(6) MessageTypeVote = Type(7) MessageTypeBlockAnnounce = Type(8) MessageTypeBlocksRequest = Type(9) MessageTypeBlocksResponse = Type(10) )
View Source
const LatestBlocksResponseCodeNoMoreBlock = 1
View Source
const LatestBlocksResponseCodeOK = 0
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BlockAnnounceMessage ¶
type BlockAnnounceMessage struct { Height uint32 `cbor:"1,keyasint"` Block *block.Block `cbor:"2,keyasint"` Certificate *block.Certificate `cbor:"3,keyasint"` }
func NewBlockAnnounceMessage ¶
func NewBlockAnnounceMessage(h uint32, b *block.Block, c *block.Certificate) *BlockAnnounceMessage
func (*BlockAnnounceMessage) Fingerprint ¶
func (m *BlockAnnounceMessage) Fingerprint() string
func (*BlockAnnounceMessage) SanityCheck ¶
func (m *BlockAnnounceMessage) SanityCheck() error
func (*BlockAnnounceMessage) Type ¶
func (m *BlockAnnounceMessage) Type() Type
type BlocksRequestMessage ¶
type BlocksRequestMessage struct { SessionID int `cbor:"1,keyasint"` From uint32 `cbor:"2,keyasint"` To uint32 `cbor:"3,keyasint"` }
func NewBlocksRequestMessage ¶
func NewBlocksRequestMessage(sid int, from, to uint32) *BlocksRequestMessage
func (*BlocksRequestMessage) Fingerprint ¶
func (m *BlocksRequestMessage) Fingerprint() string
func (*BlocksRequestMessage) SanityCheck ¶
func (m *BlocksRequestMessage) SanityCheck() error
func (*BlocksRequestMessage) Type ¶
func (m *BlocksRequestMessage) Type() Type
type BlocksResponseMessage ¶
type BlocksResponseMessage struct { ResponseCode ResponseCode `cbor:"1,keyasint"` SessionID int `cbor:"2,keyasint"` From uint32 `cbor:"3,keyasint"` Blocks []*block.Block `cbor:"4,keyasint"` LastCertificate *block.Certificate `cbor:"6,keyasint"` }
func NewBlocksResponseMessage ¶
func NewBlocksResponseMessage(code ResponseCode, sid int, from uint32, blocks []*block.Block, cert *block.Certificate) *BlocksResponseMessage
func (*BlocksResponseMessage) Fingerprint ¶
func (m *BlocksResponseMessage) Fingerprint() string
func (*BlocksResponseMessage) IsRequestRejected ¶
func (m *BlocksResponseMessage) IsRequestRejected() bool
func (*BlocksResponseMessage) SanityCheck ¶
func (m *BlocksResponseMessage) SanityCheck() error
func (*BlocksResponseMessage) To ¶
func (m *BlocksResponseMessage) To() uint32
func (*BlocksResponseMessage) Type ¶
func (m *BlocksResponseMessage) Type() Type
type HeartBeatMessage ¶
type HeartBeatMessage struct { Height uint32 `cbor:"1,keyasint"` Round int16 `cbor:"2,keyasint"` PrevBlockHash hash.Hash `cbor:"3,keyasint"` }
func NewHeartBeatMessage ¶
func NewHeartBeatMessage(h uint32, r int16, hash hash.Hash) *HeartBeatMessage
func (*HeartBeatMessage) Fingerprint ¶
func (m *HeartBeatMessage) Fingerprint() string
func (*HeartBeatMessage) SanityCheck ¶
func (m *HeartBeatMessage) SanityCheck() error
func (*HeartBeatMessage) Type ¶
func (m *HeartBeatMessage) Type() Type
type HelloMessage ¶
type HelloMessage struct { PeerID peer.ID `cbor:"1,keyasint"` Agent string `cbor:"2,keyasint"` Moniker string `cbor:"3,keyasint"` PublicKey *bls.PublicKey `cbor:"4,keyasint"` Signature *bls.Signature `cbor:"5,keyasint"` Height uint32 `cbor:"6,keyasint"` Flags int `cbor:"7,keyasint"` GenesisHash hash.Hash `cbor:"8,keyasint"` }
func NewHelloMessage ¶
func (*HelloMessage) Fingerprint ¶
func (m *HelloMessage) Fingerprint() string
func (*HelloMessage) SanityCheck ¶
func (m *HelloMessage) SanityCheck() error
func (*HelloMessage) SetPublicKey ¶
func (m *HelloMessage) SetPublicKey(pub crypto.PublicKey)
func (*HelloMessage) SetSignature ¶
func (m *HelloMessage) SetSignature(sig crypto.Signature)
func (*HelloMessage) SignBytes ¶
func (m *HelloMessage) SignBytes() []byte
func (*HelloMessage) Type ¶
func (m *HelloMessage) Type() Type
type Message ¶
func MakeMessage ¶
type ProposalMessage ¶
func NewProposalMessage ¶
func NewProposalMessage(p *proposal.Proposal) *ProposalMessage
func (*ProposalMessage) Fingerprint ¶
func (m *ProposalMessage) Fingerprint() string
func (*ProposalMessage) SanityCheck ¶
func (m *ProposalMessage) SanityCheck() error
func (*ProposalMessage) Type ¶
func (m *ProposalMessage) Type() Type
type QueryProposalMessage ¶
type QueryProposalMessage struct { Height uint32 `cbor:"1,keyasint"` Round int16 `cbor:"2,keyasint"` }
func NewQueryProposalMessage ¶
func NewQueryProposalMessage(h uint32, r int16) *QueryProposalMessage
func (*QueryProposalMessage) Fingerprint ¶
func (m *QueryProposalMessage) Fingerprint() string
func (*QueryProposalMessage) SanityCheck ¶
func (m *QueryProposalMessage) SanityCheck() error
func (*QueryProposalMessage) Type ¶
func (m *QueryProposalMessage) Type() Type
type QueryVotesMessage ¶
func NewQueryVotesMessage ¶
func NewQueryVotesMessage(h uint32, r int16) *QueryVotesMessage
func (*QueryVotesMessage) Fingerprint ¶
func (m *QueryVotesMessage) Fingerprint() string
func (*QueryVotesMessage) SanityCheck ¶
func (m *QueryVotesMessage) SanityCheck() error
func (*QueryVotesMessage) Type ¶
func (m *QueryVotesMessage) Type() Type
type ResponseCode ¶
type ResponseCode int
func (ResponseCode) String ¶
func (c ResponseCode) String() string
type TransactionsMessage ¶
func NewTransactionsMessage ¶
func NewTransactionsMessage(trxs []*tx.Tx) *TransactionsMessage
func (*TransactionsMessage) Fingerprint ¶
func (m *TransactionsMessage) Fingerprint() string
func (*TransactionsMessage) SanityCheck ¶
func (m *TransactionsMessage) SanityCheck() error
func (*TransactionsMessage) Type ¶
func (m *TransactionsMessage) Type() Type
type VoteMessage ¶
func NewVoteMessage ¶
func NewVoteMessage(v *vote.Vote) *VoteMessage
func (*VoteMessage) Fingerprint ¶
func (m *VoteMessage) Fingerprint() string
func (*VoteMessage) SanityCheck ¶
func (m *VoteMessage) SanityCheck() error
func (*VoteMessage) Type ¶
func (m *VoteMessage) Type() Type
Click to show internal directories.
Click to hide internal directories.