message

package
v0.0.0-...-55fbe73 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2022 License: LGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// EthMsgSoftCapSize is the ideal size of encoded transaction bytes we send in
	// any [EthTxs] or [AtomicTx] message. We do not limit inbound messages to
	// this size, however. Max inbound message size is enforced by the codec
	// (512KB).
	EthMsgSoftCapSize = common.StorageSize(64 * units.KiB)
)

Variables

This section is empty.

Functions

func Build

func Build(msg Message) ([]byte, error)

Types

type AtomicTx

type AtomicTx struct {
	Tx []byte `serialize:"true"`
	// contains filtered or unexported fields
}

func (*AtomicTx) Bytes

func (m *AtomicTx) Bytes() []byte

func (*AtomicTx) Handle

func (msg *AtomicTx) Handle(handler Handler, nodeID ids.ShortID, requestID uint32) error

type EthTxs

type EthTxs struct {
	Txs []byte `serialize:"true"`
	// contains filtered or unexported fields
}

func (*EthTxs) Bytes

func (m *EthTxs) Bytes() []byte

func (*EthTxs) Handle

func (msg *EthTxs) Handle(handler Handler, nodeID ids.ShortID, requestID uint32) error

type Handler

type Handler interface {
	HandleAtomicTx(nodeID ids.ShortID, requestID uint32, msg *AtomicTx) error
	HandleEthTxs(nodeID ids.ShortID, requestID uint32, msg *EthTxs) error
}

type Message

type Message interface {
	// Handle this message with the correct message handler
	Handle(handler Handler, nodeID ids.ShortID, requestID uint32) error

	// Bytes returns the binary representation of this message
	//
	// Bytes should only be called after being initialized
	Bytes() []byte
	// contains filtered or unexported methods
}

func Parse

func Parse(bytes []byte) (Message, error)

type NoopHandler

type NoopHandler struct{}

func (NoopHandler) HandleAtomicTx

func (NoopHandler) HandleAtomicTx(nodeID ids.ShortID, requestID uint32, _ *AtomicTx) error

func (NoopHandler) HandleEthTxs

func (NoopHandler) HandleEthTxs(nodeID ids.ShortID, requestID uint32, _ *EthTxs) error

Jump to

Keyboard shortcuts

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