Method: Reth::ETHProtocol::NewBlock.decode_payload

Defined in:
lib/reth/eth_protocol.rb

.decode_payload(rlp_data) ⇒ Object

Raises:

  • (AssertError)


161
162
163
164
165
166
167
168
169
# File 'lib/reth/eth_protocol.rb', line 161

def self.decode_payload(rlp_data)
  ll = RLP.decode_lazy rlp_data
  raise AssertError unless ll.size == 2

  transient_block = TransientBlock.new ll[0], Time.now
  difficulty = RLP::Sedes.big_endian_int.deserialize ll[1]

  {block: transient_block, chain_difficulty: difficulty}
end