message

package
v0.15.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 15, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ResponseCodeOK           = ResponseCode(0)
	ResponseCodeRejected     = ResponseCode(1)
	ResponseCodeMoreBlocks   = ResponseCode(2)
	ResponseCodeNoMoreBlocks = ResponseCode(3)
	ResponseCodeSynced       = ResponseCode(4)
)
View Source
const (
	TypeUnspecified    = Type(0)
	TypeHello          = Type(1)
	TypeHelloAck       = Type(2)
	TypeTransactions   = Type(3)
	TypeQueryProposal  = Type(4)
	TypeProposal       = Type(5)
	TypeQueryVotes     = Type(6)
	TypeVote           = Type(7)
	TypeBlockAnnounce  = Type(8)
	TypeBlocksRequest  = Type(9)
	TypeBlocksResponse = Type(10)
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BlockAnnounceMessage

type BlockAnnounceMessage struct {
	Block       *block.Block             `cbor:"1,keyasint"`
	Certificate *certificate.Certificate `cbor:"2,keyasint"`
}

func NewBlockAnnounceMessage

func NewBlockAnnounceMessage(blk *block.Block, cert *certificate.Certificate) *BlockAnnounceMessage

func (*BlockAnnounceMessage) BasicCheck added in v0.15.0

func (m *BlockAnnounceMessage) BasicCheck() error

func (*BlockAnnounceMessage) Height

func (m *BlockAnnounceMessage) Height() uint32

func (*BlockAnnounceMessage) String added in v0.15.0

func (m *BlockAnnounceMessage) String() string

func (*BlockAnnounceMessage) Type

func (m *BlockAnnounceMessage) Type() Type

type BlocksRequestMessage

type BlocksRequestMessage struct {
	SessionID int    `cbor:"1,keyasint"`
	From      uint32 `cbor:"2,keyasint"`
	Count     uint32 `cbor:"3,keyasint"`
}

func NewBlocksRequestMessage

func NewBlocksRequestMessage(sid int, from, count uint32) *BlocksRequestMessage

func (*BlocksRequestMessage) BasicCheck added in v0.15.0

func (m *BlocksRequestMessage) BasicCheck() error

func (*BlocksRequestMessage) String added in v0.15.0

func (m *BlocksRequestMessage) String() string

func (*BlocksRequestMessage) To

func (m *BlocksRequestMessage) To() uint32

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"`
	CommittedBlocksData [][]byte                 `cbor:"4,keyasint"`
	LastCertificate     *certificate.Certificate `cbor:"5,keyasint"`
	Reason              string                   `cbor:"6,keyasint"`
}

func NewBlocksResponseMessage

func NewBlocksResponseMessage(code ResponseCode, reason string, sid int, from uint32,
	blocksData [][]byte, lastCert *certificate.Certificate,
) *BlocksResponseMessage

func (*BlocksResponseMessage) BasicCheck added in v0.15.0

func (m *BlocksResponseMessage) BasicCheck() error

func (*BlocksResponseMessage) Count added in v0.11.0

func (m *BlocksResponseMessage) Count() uint32

func (*BlocksResponseMessage) IsRequestRejected

func (m *BlocksResponseMessage) IsRequestRejected() bool

func (*BlocksResponseMessage) String added in v0.15.0

func (m *BlocksResponseMessage) String() string

func (*BlocksResponseMessage) To

func (m *BlocksResponseMessage) To() uint32

func (*BlocksResponseMessage) Type

func (m *BlocksResponseMessage) Type() Type

type HelloAckMessage added in v0.15.0

type HelloAckMessage struct {
	ResponseCode ResponseCode `cbor:"1,keyasint"`
	Reason       string       `cbor:"2,keyasint"`
}

func NewHelloAckMessage added in v0.15.0

func NewHelloAckMessage(code ResponseCode, reason string) *HelloAckMessage

func (*HelloAckMessage) BasicCheck added in v0.15.0

func (m *HelloAckMessage) BasicCheck() error

func (*HelloAckMessage) String added in v0.15.0

func (m *HelloAckMessage) String() string

func (*HelloAckMessage) Type added in v0.15.0

func (m *HelloAckMessage) Type() Type

type HelloMessage

type HelloMessage struct {
	PeerID          peer.ID           `cbor:"1,keyasint"`
	Agent           string            `cbor:"2,keyasint"`
	Moniker         string            `cbor:"3,keyasint"`
	PublicKeys      []*bls.PublicKey  `cbor:"4,keyasint"`
	Signature       *bls.Signature    `cbor:"5,keyasint"`
	Height          uint32            `cbor:"6,keyasint"`
	Services        services.Services `cbor:"7,keyasint"`
	GenesisHash     hash.Hash         `cbor:"8,keyasint"`
	BlockHash       hash.Hash         `cbor:"9,keyasint"`
	MyTimeUnixMilli int64             `cbor:"10,keyasint"`
}

func NewHelloMessage

func NewHelloMessage(pid peer.ID, moniker string,
	height uint32, services services.Services, blockHash, genesisHash hash.Hash,
) *HelloMessage

func (*HelloMessage) BasicCheck added in v0.15.0

func (m *HelloMessage) BasicCheck() error

func (*HelloMessage) MyTime added in v0.15.0

func (m *HelloMessage) MyTime() time.Time

func (*HelloMessage) Sign added in v0.15.0

func (m *HelloMessage) Sign(valKeys []*bls.ValidatorKey)

func (*HelloMessage) SignBytes

func (m *HelloMessage) SignBytes() []byte

func (*HelloMessage) String added in v0.15.0

func (m *HelloMessage) String() string

func (*HelloMessage) Type

func (m *HelloMessage) Type() Type

type Message

type Message interface {
	BasicCheck() error
	Type() Type
	String() string
}

func MakeMessage

func MakeMessage(t Type) Message

type ProposalMessage

type ProposalMessage struct {
	Proposal *proposal.Proposal `cbor:"1,keyasint"`
}

func NewProposalMessage

func NewProposalMessage(p *proposal.Proposal) *ProposalMessage

func (*ProposalMessage) BasicCheck added in v0.15.0

func (m *ProposalMessage) BasicCheck() error

func (*ProposalMessage) String added in v0.15.0

func (m *ProposalMessage) String() string

func (*ProposalMessage) Type

func (m *ProposalMessage) Type() Type

type QueryProposalMessage

type QueryProposalMessage struct {
	Height uint32 `cbor:"1,keyasint"`
}

func NewQueryProposalMessage

func NewQueryProposalMessage(h uint32) *QueryProposalMessage

func (*QueryProposalMessage) BasicCheck added in v0.15.0

func (m *QueryProposalMessage) BasicCheck() error

func (*QueryProposalMessage) String added in v0.15.0

func (m *QueryProposalMessage) String() string

func (*QueryProposalMessage) Type

func (m *QueryProposalMessage) Type() Type

type QueryVotesMessage

type QueryVotesMessage struct {
	Height uint32 `cbor:"1,keyasint"`
	Round  int16  `cbor:"2,keyasint"`
}

func NewQueryVotesMessage

func NewQueryVotesMessage(h uint32, r int16) *QueryVotesMessage

func (*QueryVotesMessage) BasicCheck added in v0.15.0

func (m *QueryVotesMessage) BasicCheck() error

func (*QueryVotesMessage) String added in v0.15.0

func (m *QueryVotesMessage) String() string

func (*QueryVotesMessage) Type

func (m *QueryVotesMessage) Type() Type

type ResponseCode

type ResponseCode int

func (ResponseCode) String

func (c ResponseCode) String() string

type TransactionsMessage

type TransactionsMessage struct {
	Transactions []*tx.Tx `cbor:"1,keyasint"`
}

func NewTransactionsMessage

func NewTransactionsMessage(trxs []*tx.Tx) *TransactionsMessage

func (*TransactionsMessage) BasicCheck added in v0.15.0

func (m *TransactionsMessage) BasicCheck() error

func (*TransactionsMessage) String added in v0.15.0

func (m *TransactionsMessage) String() string

func (*TransactionsMessage) Type

func (m *TransactionsMessage) Type() Type

type Type

type Type int32

func (Type) String

func (t Type) String() string

func (Type) TopicID

func (t Type) TopicID() network.TopicID

type VoteMessage

type VoteMessage struct {
	Vote *vote.Vote `cbor:"1,keyasint"`
}

func NewVoteMessage

func NewVoteMessage(v *vote.Vote) *VoteMessage

func (*VoteMessage) BasicCheck added in v0.15.0

func (m *VoteMessage) BasicCheck() error

func (*VoteMessage) String added in v0.15.0

func (m *VoteMessage) String() string

func (*VoteMessage) Type

func (m *VoteMessage) Type() Type

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL