Class: Reth::ETHProtocol::Blocks

Inherits:
DEVp2p::Command
  • Object
show all
Defined in:
lib/reth/eth_protocol.rb

Overview

Specify (a) block(s) as an answer to GetBlocks. The items in the list (following the message ID) are blocks in the format described in the main Ethereum specification. This may validly contain no blocks if no blocks were able to be returned for the GetBlocks query.

Class Method Summary collapse

Class Method Details

.decode_payload(rlp_data) ⇒ Object



140
141
142
143
# File 'lib/reth/eth_protocol.rb', line 140

def decode_payload(rlp_data)
  blocks = []
  RLP.decode_lazy(rlp_data).map {|block| TransientBlock.new block }
end

.encode_payload(list_of_rlp) ⇒ Object



136
137
138
# File 'lib/reth/eth_protocol.rb', line 136

def encode_payload(list_of_rlp)
  RLP.encode(list_of_rlp.map {|x| RLP::Data.new(x) }, infer_serializer: false)
end