types

package
v0.0.0-...-f5d07b1 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2019 License: LGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var LastInvHash common.Uint256

Functions

func WriteMessage

func WriteMessage(sink *comm.ZeroCopySink, msg Message)

Types

type Addr

type Addr struct {
	NodeAddrs []comm.PeerAddr
}

func (*Addr) CmdType

func (this *Addr) CmdType() string

func (*Addr) Deserialization

func (this *Addr) Deserialization(source *common.ZeroCopySource) error

func (Addr) Serialization

func (this Addr) Serialization(sink *common.ZeroCopySink)

Serialize message payload

type AddrReq

type AddrReq struct{}

func (*AddrReq) CmdType

func (this *AddrReq) CmdType() string

func (*AddrReq) Deserialization

func (this *AddrReq) Deserialization(source *common.ZeroCopySource) error

Deserialize message payload

func (AddrReq) Serialization

func (this AddrReq) Serialization(sink *common.ZeroCopySink)

Serialize message payload

type BlkHeader

type BlkHeader struct {
	BlkHdr []*ct.Header
}

func (*BlkHeader) CmdType

func (this *BlkHeader) CmdType() string

func (*BlkHeader) Deserialization

func (this *BlkHeader) Deserialization(source *common.ZeroCopySource) error

Deserialize message payload

func (BlkHeader) Serialization

func (this BlkHeader) Serialization(sink *common.ZeroCopySink)

Serialize message payload

type Block

type Block struct {
	Blk        *types.Block
	MerkleRoot common.Uint256
}

func (*Block) CmdType

func (this *Block) CmdType() string

func (*Block) Deserialization

func (this *Block) Deserialization(source *common.ZeroCopySource) error

Deserialize message payload

func (*Block) Serialization

func (this *Block) Serialization(sink *common.ZeroCopySink)

Serialize message payload

type BlocksReq

type BlocksReq struct {
	HeaderHashCount uint8
	HashStart       comm.Uint256
	HashStop        comm.Uint256
}

func (*BlocksReq) CmdType

func (this *BlocksReq) CmdType() string

func (*BlocksReq) Deserialization

func (this *BlocksReq) Deserialization(source *comm.ZeroCopySource) error

Deserialize message payload

func (*BlocksReq) Serialization

func (this *BlocksReq) Serialization(sink *comm.ZeroCopySink)

Serialize message payload

type Consensus

type Consensus struct {
	Cons ConsensusPayload
}

func (*Consensus) CmdType

func (this *Consensus) CmdType() string

func (*Consensus) Deserialization

func (this *Consensus) Deserialization(source *comm.ZeroCopySource) error

Deserialize message payload

func (*Consensus) Serialization

func (this *Consensus) Serialization(sink *comm.ZeroCopySink)

Serialize message payload

type ConsensusPayload

type ConsensusPayload struct {
	Version         uint32
	PrevHash        common.Uint256
	Height          uint32
	BookkeeperIndex uint16
	Timestamp       uint32
	Data            []byte
	Owner           keypair.PublicKey
	Signature       []byte
	PeerId          uint64
	// contains filtered or unexported fields
}

func (*ConsensusPayload) Deserialization

func (this *ConsensusPayload) Deserialization(source *common.ZeroCopySource) error

Deserialize message payload

func (*ConsensusPayload) Deserialize

func (this *ConsensusPayload) Deserialize(r io.Reader) error

Deserialize message payload

func (*ConsensusPayload) DeserializeUnsigned

func (this *ConsensusPayload) DeserializeUnsigned(r io.Reader) error

Deserialize message payload

func (*ConsensusPayload) GetMessage

func (this *ConsensusPayload) GetMessage() []byte

func (*ConsensusPayload) Hash

func (this *ConsensusPayload) Hash() common.Uint256

get the consensus payload hash

func (*ConsensusPayload) InventoryType

func (this *ConsensusPayload) InventoryType() common.InventoryType

return inventory type

func (*ConsensusPayload) Serialization

func (this *ConsensusPayload) Serialization(sink *common.ZeroCopySink)

func (*ConsensusPayload) Serialize

func (this *ConsensusPayload) Serialize(w io.Writer) error

Serialize message payload

func (*ConsensusPayload) SerializeUnsigned

func (this *ConsensusPayload) SerializeUnsigned(w io.Writer) error

Serialize message payload

func (*ConsensusPayload) ToArray

func (this *ConsensusPayload) ToArray() []byte

serialize the consensus payload

func (*ConsensusPayload) Type

func (this *ConsensusPayload) Type() common.InventoryType

func (*ConsensusPayload) Verify

func (this *ConsensusPayload) Verify() error

Check whether header is correct

type DataReq

type DataReq struct {
	DataType common.InventoryType
	Hash     common.Uint256
}

func (*DataReq) CmdType

func (this *DataReq) CmdType() string

func (*DataReq) Deserialization

func (this *DataReq) Deserialization(source *common.ZeroCopySource) error

Deserialize message payload

func (DataReq) Serialization

func (this DataReq) Serialization(sink *common.ZeroCopySink)

Serialize message payload

type Disconnected

type Disconnected struct{}

func (Disconnected) CmdType

func (this Disconnected) CmdType() string

func (*Disconnected) Deserialization

func (this *Disconnected) Deserialization(source *comm.ZeroCopySource) error

Deserialize message payload

func (Disconnected) Serialization

func (this Disconnected) Serialization(sink *comm.ZeroCopySink)

Serialize message payload

type HeadersReq

type HeadersReq struct {
	Len       uint8
	HashStart common.Uint256
	HashEnd   common.Uint256
}

func (*HeadersReq) CmdType

func (this *HeadersReq) CmdType() string

func (*HeadersReq) Deserialization

func (this *HeadersReq) Deserialization(source *common.ZeroCopySource) error

Deserialize message payload

func (*HeadersReq) Serialization

func (this *HeadersReq) Serialization(sink *common.ZeroCopySink)

Serialize message payload

type Inv

type Inv struct {
	P InvPayload
}

func (*Inv) CmdType

func (this *Inv) CmdType() string

func (*Inv) Deserialization

func (this *Inv) Deserialization(source *common.ZeroCopySource) error

Deserialize message payload

func (Inv) Serialization

func (this Inv) Serialization(sink *common.ZeroCopySink)

Serialize message payload

type InvPayload

type InvPayload struct {
	InvType common.InventoryType
	Blk     []common.Uint256
}

type Message

type Message interface {
	Serialization(sink *comm.ZeroCopySink)
	Deserialization(source *comm.ZeroCopySource) error
	CmdType() string
}

func MakeEmptyMessage

func MakeEmptyMessage(cmdType string) (Message, error)

func ReadMessage

func ReadMessage(reader io.Reader) (Message, uint32, error)

type MsgPayload

type MsgPayload struct {
	Id          uint64  //peer ID
	Addr        string  //link address
	PayloadSize uint32  //payload size
	Payload     Message //msg payload
}

MsgPayload in link channel

type NotFound

type NotFound struct {
	Hash common.Uint256
}

func (NotFound) CmdType

func (this NotFound) CmdType() string

func (*NotFound) Deserialization

func (this *NotFound) Deserialization(source *common.ZeroCopySource) error

Deserialize message payload

func (NotFound) Serialization

func (this NotFound) Serialization(sink *common.ZeroCopySink)

Serialize message payload

type Ping

type Ping struct {
	Height uint64
}

func (*Ping) CmdType

func (this *Ping) CmdType() string

func (*Ping) Deserialization

func (this *Ping) Deserialization(source *comm.ZeroCopySource) error

Deserialize message payload

func (Ping) Serialization

func (this Ping) Serialization(sink *comm.ZeroCopySink)

Serialize message payload

type Pong

type Pong struct {
	Height uint64
}

func (Pong) CmdType

func (this Pong) CmdType() string

func (*Pong) Deserialization

func (this *Pong) Deserialization(source *comm.ZeroCopySource) error

Deserialize message payload

func (Pong) Serialization

func (this Pong) Serialization(sink *comm.ZeroCopySink)

Serialize message payload

type RawBlockHeader

type RawBlockHeader struct {
	BlkHdr []*ct.RawHeader
}

func (*RawBlockHeader) CmdType

func (this *RawBlockHeader) CmdType() string

func (*RawBlockHeader) Deserialization

func (this *RawBlockHeader) Deserialization(source *common.ZeroCopySource) error

func (*RawBlockHeader) Serialization

func (this *RawBlockHeader) Serialization(sink *common.ZeroCopySink)

type Trn

type Trn struct {
	Txn *types.Transaction
}

Transaction message

func (*Trn) CmdType

func (this *Trn) CmdType() string

func (*Trn) Deserialization

func (this *Trn) Deserialization(source *comm.ZeroCopySource) error

Deserialize message payload

func (Trn) Serialization

func (this Trn) Serialization(sink *comm.ZeroCopySink)

Serialize message payload

type VerACK

type VerACK struct {
	// contains filtered or unexported fields
}

func (*VerACK) CmdType

func (this *VerACK) CmdType() string

func (*VerACK) Deserialization

func (this *VerACK) Deserialization(source *comm.ZeroCopySource) error

Deserialize message payload

func (*VerACK) Serialization

func (this *VerACK) Serialization(sink *comm.ZeroCopySink)

Serialize message payload

type Version

type Version struct {
	P VersionPayload
}

func (*Version) CmdType

func (this *Version) CmdType() string

func (*Version) Deserialization

func (this *Version) Deserialization(source *comm.ZeroCopySource) error

Deserialize message payload

func (*Version) Serialization

func (this *Version) Serialization(sink *comm.ZeroCopySink)

Serialize message payload

type VersionPayload

type VersionPayload struct {
	Version      uint32
	Services     uint64
	TimeStamp    int64
	SyncPort     uint16
	HttpInfoPort uint16
	//TODO remove this legecy field
	ConsPort    uint16
	Cap         [32]byte
	Nonce       uint64
	StartHeight uint64
	Relay       uint8
	IsConsensus bool
	SoftVersion string
}

Jump to

Keyboard shortcuts

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