ex_wire v0.1.1 ExWire.Packet.GetBlockBodies

Request the bodies for a set of blocks by hash.

`GetBlockBodies` [`+0x05`, `hash_0`: `B_32`, `hash_1`: `B_32`, ...]

Require peer to return a BlockBodies message. Specify the set of blocks that
we're interested in with the hashes.

Link to this section Summary

Functions

Given an RLP-encoded GetBlockBodies packet from Eth Wire Protocol, decodes into a GetBlockBodies struct

Handles a GetBlockBodies message. We shoud send the block bodies to the peer if we have them. For now, we’ll do nothing

Given a GetBlockBodies packet, serializes for transport over Eth Wire Protocol

Link to this section Types

Link to this type t()
t() :: %ExWire.Packet.GetBlockBodies{hashes: [binary]}

Link to this section Functions

Link to this function deserialize(rlp)
deserialize(ExRLP.t) :: t

Given an RLP-encoded GetBlockBodies packet from Eth Wire Protocol, decodes into a GetBlockBodies struct.

Examples

iex> ExWire.Packet.GetBlockBodies.deserialize([<<5>>, <<6>>])
%ExWire.Packet.GetBlockBodies{hashes: [<<5>>, <<6>>]}

Handles a GetBlockBodies message. We shoud send the block bodies to the peer if we have them. For now, we’ll do nothing.

Examples

iex> %ExWire.Packet.GetBlockBodies{hashes: [<<5>>, <<6>>]}
...> |> ExWire.Packet.GetBlockBodies.handle()
:ok
Link to this function serialize(packet)
serialize(t) :: ExRLP.t

Given a GetBlockBodies packet, serializes for transport over Eth Wire Protocol.

Examples

iex> %ExWire.Packet.GetBlockBodies{hashes: [<<5>>, <<6>>]}
...> |> ExWire.Packet.GetBlockBodies.serialize
[<<5>>, <<6>>]