class GetBeaconBlocks(Command): _cmd_id = 1 structure = [ ('request_id', sedes.big_endian_int), ('block_slot_or_root', HashOrNumber()), ('max_blocks', sedes.big_endian_int), ]
class GetBlockHeadersQuery(rlp.Serializable): fields = ( ('block_number_or_hash', HashOrNumber()), ('max_headers', sedes.big_endian_int), ('skip', sedes.big_endian_int), ('reverse', sedes.boolean), )
class GetBlockHeaders(Command): _cmd_id = 3 structure = ( ('block_number_or_hash', HashOrNumber()), ('max_headers', sedes.big_endian_int), ('skip', sedes.big_endian_int), ('reverse', sedes.boolean), )
class GetBlockHeadersV65(BaseCommand[BlockHeadersQuery]): protocol_command_id = 3 serialization_codec: RLPCodec[BlockHeadersQuery] = RLPCodec( sedes=sedes.List(( HashOrNumber(), sedes.big_endian_int, sedes.big_endian_int, sedes.boolean, )), process_inbound_payload_fn=lambda args: BlockHeadersQuery(*args), )
# Status msg. Need to extend this command to process that too. sedes.CountableList(sedes.List((sedes.text, sedes.raw))), # params )) class Announce(BaseCommand[AnnouncePayload]): protocol_command_id = 1 serialization_codec = RLPCodec( sedes=ANNOUNCE_STRUCTURE, process_inbound_payload_fn=lambda args: AnnouncePayload(*args), ) GET_BLOCK_HEADERS_STRUCTURE = sedes.List(( sedes.big_endian_int, sedes.List((HashOrNumber(), sedes.big_endian_int, sedes.big_endian_int, sedes.boolean)), )) class GetBlockHeaders(BaseCommand[GetBlockHeadersPayload]): protocol_command_id = 2 serialization_codec = RLPCodec( sedes=GET_BLOCK_HEADERS_STRUCTURE, process_inbound_payload_fn=compose( lambda args: GetBlockHeadersPayload(*args), apply_formatter_at_index(lambda args: BlockHeadersQuery(*args), 1)), )
lambda args: NewBlockHash(*args)), ) TRANSACTIONS_STRUCTURE = sedes.CountableList(BaseTransactionFields) class Transactions(BaseCommand[Tuple[BaseTransactionFields, ...]]): protocol_command_id = 2 serialization_codec: RLPCodec[Tuple[BaseTransactionFields, ...]] = RLPCodec( sedes=TRANSACTIONS_STRUCTURE, ) GET_BLOCK_HEADERS_STRUCTURE = sedes.List(( HashOrNumber(), sedes.big_endian_int, sedes.big_endian_int, sedes.boolean, )) class GetBlockHeaders(BaseCommand[BlockHeadersQuery]): protocol_command_id = 3 serialization_codec: RLPCodec[BlockHeadersQuery] = RLPCodec( sedes=GET_BLOCK_HEADERS_STRUCTURE, process_inbound_payload_fn=lambda args: BlockHeadersQuery(*args), ) BLOCK_HEADERS_STRUCTURE = sedes.CountableList(BlockHeader)