[][src]Module grin_p2p::msg

Message types that transit over the network and related serialization code.

Structs

BanReason
GetPeerAddrs

Ask for other peers addresses, required for network discovery.

Hand

First part of a handshake, sender advertises its version and characteristics.

Headers

Serializable wrapper for a list of block headers.

Locator

Serializable wrapper for the block locator.

Msg
MsgHeader

Header of any protocol message, used to identify incoming messages.

PeerAddrs

Peer addresses we know of that are fresh enough, in response to GetPeerAddrs.

PeerError

We found some issue in the communication, sending an error back, usually followed by closing the connection.

Ping
Pong
Shake

Second part of a handshake, receiver of the first part replies with its own version and characteristics.

TxHashSetArchive

Response to a txhashset archive request, must include a zip stream of the archive after the message body.

TxHashSetRequest

Request to get an archive of the full txhashset store, required to sync a new node.

Enums

MsgHeaderWrapper

A wrapper around a message header. If the header is for an unknown msg type then we will be unable to parse the msg itself (just a bunch of random bytes). But we need to know how many bytes to discard to discard the full message.

Type

Constants

USER_AGENT

Grin's user agent with current version

Functions

read_body

Read a message body from the provided stream, always blocking until we have a result (or timeout).

read_discard

Read (an unknown) message from the provided stream and discard it.

read_header

Read a header from the provided stream without blocking if the underlying stream is async. Typically headers will be polled for, so we do not want to block.

read_item

Read a single item from the provided stream, always blocking until we have a result (or timeout). Returns the item and the total bytes read.

read_message

Reads a full message from the underlying stream.

write_message