ex_wire v0.1.1 ExWire.Packet.NewBlockHashes
Advertises new blocks to the network.
**NewBlockHashes** [`+0x01`: `P`, [`hash_0`: `B_32`, `number_0`: `P`], [`hash_1`: `B_32`, `number_1`: `P`], ...]
Specify one or more new blocks which have appeared on the
network. To be maximally helpful, nodes should inform peers of all blocks that
they may not be aware of. Including hashes that the sending peer could
reasonably be considered to know (due to the fact they were previously
informed of because that node has itself advertised knowledge of the hashes
through NewBlockHashes) is considered Bad Form, and may reduce the reputation
of the sending node. Including hashes that the sending node later refuses to
honour with a proceeding GetBlockHeaders message is considered Bad Form, and
may reduce the reputation of the sending node.
Link to this section Summary
Functions
Given an RLP-encoded NewBlockHashes packet from Eth Wire Protocol, decodes into a NewBlockHashes struct
Handles a NewBlockHashes message. This is when a peer wants to inform us that she knows about new blocks. For now, we’ll do nothing
Given a NewBlockHashes packet, serializes for transport over Eth Wire Protocol
Link to this section Types
Link to this section Functions
Given an RLP-encoded NewBlockHashes packet from Eth Wire Protocol, decodes into a NewBlockHashes struct.
Examples
iex> ExWire.Packet.NewBlockHashes.deserialize([[<<5>>, 1], [<<6>>, 2]])
%ExWire.Packet.NewBlockHashes{hashes: [{<<5>>, 1}, {<<6>>, 2}]}
iex> ExWire.Packet.NewBlockHashes.deserialize([])
** (MatchError) no match of right hand side value: []
Handles a NewBlockHashes message. This is when a peer wants to inform us that she knows about new blocks. For now, we’ll do nothing.
Examples
iex> %ExWire.Packet.NewBlockHashes{hashes: [{<<5>>, 1}, {<<6>>, 2}]}
...> |> ExWire.Packet.NewBlockHashes.handle()
:ok
Given a NewBlockHashes packet, serializes for transport over Eth Wire Protocol.
Examples
iex> %ExWire.Packet.NewBlockHashes{hashes: [{<<5>>, 1}, {<<6>>, 2}]}
...> |> ExWire.Packet.NewBlockHashes.serialize()
[[<<5>>, 1], [<<6>>, 2]]
iex> %ExWire.Packet.NewBlockHashes{hashes: []}
...> |> ExWire.Packet.NewBlockHashes.serialize()
[]