payload

package
v0.5.0-pre Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2019 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddressAndTime

type AddressAndTime struct {
	Timestamp uint32
	Services  uint64
	Endpoint  util.Endpoint
}

AddressAndTime payload.

func NewAddressAndTime

func NewAddressAndTime(e util.Endpoint, t time.Time) *AddressAndTime

NewAddressAndTime creates a new AddressAndTime object.

func (*AddressAndTime) DecodeBinary

func (p *AddressAndTime) DecodeBinary(r io.Reader) error

DecodeBinary implements the Payload interface.

func (*AddressAndTime) EncodeBinary

func (p *AddressAndTime) EncodeBinary(w io.Writer) error

EncodeBinary implements the Payload interface.

type AddressList

type AddressList struct {
	Addrs []*AddressAndTime
}

AddressList is a list with AddrAndTime.

func (*AddressList) DecodeBinary

func (p *AddressList) DecodeBinary(r io.Reader) error

DecodeBinary implements the Payload interface.

func (*AddressList) EncodeBinary

func (p *AddressList) EncodeBinary(w io.Writer) error

EncodeBinary implements the Payload interface.

type GetBlocks

type GetBlocks struct {
	// hash of latest block that node requests
	HashStart []util.Uint256
	// hash of last block that node requests
	HashStop util.Uint256
}

GetBlocks contains fields and methods to be shared with the

func NewGetBlocks

func NewGetBlocks(start []util.Uint256, stop util.Uint256) *GetBlocks

NewGetBlocks return a pointer to a GetBlocks object.

func (*GetBlocks) DecodeBinary

func (p *GetBlocks) DecodeBinary(r io.Reader) error

DecodeBinary implements the payload interface.

func (*GetBlocks) EncodeBinary

func (p *GetBlocks) EncodeBinary(w io.Writer) error

EncodeBinary implements the payload interface.

func (*GetBlocks) Size

func (p *GetBlocks) Size() uint32

Size implements the payload interface.

type Headers

type Headers struct {
	Hdrs []*core.Header
}

Headers payload

func (*Headers) DecodeBinary

func (p *Headers) DecodeBinary(r io.Reader) error

DecodeBinary implements the Payload interface.

func (*Headers) EncodeBinary

func (p *Headers) EncodeBinary(w io.Writer) error

EncodeBinary implements the Payload interface.

type Inventory

type Inventory struct {
	// Type if the object hash.
	Type InventoryType

	// A list of hashes.
	Hashes []util.Uint256
}

Inventory payload

func NewInventory

func NewInventory(typ InventoryType, hashes []util.Uint256) *Inventory

NewInventory return a pointer to an Inventory.

func (*Inventory) DecodeBinary

func (p *Inventory) DecodeBinary(r io.Reader) error

DecodeBinary implements the Payload interface.

func (*Inventory) EncodeBinary

func (p *Inventory) EncodeBinary(w io.Writer) error

EncodeBinary implements the Payload interface.

type InventoryType

type InventoryType uint8

InventoryType is the type of an object in the Inventory message.

const (
	TXType        InventoryType = 0x01 // 1
	BlockType     InventoryType = 0x02 // 2
	ConsensusType InventoryType = 0xe0 // 224
)

List of valid InventoryTypes.

func (InventoryType) String

func (i InventoryType) String() string

String implements the Stringer interface.

func (InventoryType) Valid

func (i InventoryType) Valid() bool

Valid returns true if the inventory (type) is known.

type MerkleBlock

type MerkleBlock struct {
	*core.BlockBase
	TxCount int
	Hashes  []util.Uint256
	Flags   []byte
}

func (*MerkleBlock) DecodeBinary

func (m *MerkleBlock) DecodeBinary(r io.Reader) error

func (*MerkleBlock) EncodeBinary

func (m *MerkleBlock) EncodeBinary(w io.Writer) error

type Payload

type Payload interface {
	EncodeBinary(io.Writer) error
	DecodeBinary(io.Reader) error
}

Payload is anything that can be binary encoded/decoded.

type Version

type Version struct {
	// currently the version of the protocol is 0
	Version uint32
	// currently 1
	Services uint64
	// timestamp
	Timestamp uint32
	// port this server is listening on
	Port uint16
	// it's used to distinguish the node from public IP
	Nonce uint32
	// client id
	UserAgent []byte
	// Height of the block chain
	StartHeight uint32
	// Whether to receive and forward
	Relay bool
}

Version payload.

func NewVersion

func NewVersion(id uint32, p uint16, ua string, h uint32, r bool) *Version

NewVersion returns a pointer to a Version payload.

func (*Version) DecodeBinary

func (p *Version) DecodeBinary(r io.Reader) error

DecodeBinary implements the Payload interface.

func (*Version) EncodeBinary

func (p *Version) EncodeBinary(w io.Writer) error

EncodeBinary implements the Payload interface.

func (*Version) Size

func (p *Version) Size() uint32

Size implements the payloader interface.

Jump to

Keyboard shortcuts

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