Skip to content

Commit

Permalink
Merge pull request #29 from AntelopeIO/getstatusv1
Browse files Browse the repository at this point in the history
add to ship definitions status_request v1 (for finality_data range)
  • Loading branch information
spoonincode authored Jun 12, 2024
2 parents 1ca40c8 + 81b2233 commit fcfd189
Showing 1 changed file with 22 additions and 5 deletions.
27 changes: 22 additions & 5 deletions include/eosio/ship_protocol.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,25 +80,42 @@ namespace eosio { namespace ship_protocol {

EOSIO_REFLECT(get_status_request_v0)

struct get_status_request_v1 {};

EOSIO_REFLECT(get_status_request_v1)

struct block_position {
uint32_t block_num = {};
eosio::checksum256 block_id = {};
};

EOSIO_REFLECT(block_position, block_num, block_id)

struct get_status_result_v0 {
struct get_status_result_base {
block_position head = {};
block_position last_irreversible = {};
uint32_t trace_begin_block = {};
uint32_t trace_end_block = {};
uint32_t chain_state_begin_block = {};
uint32_t chain_state_end_block = {};
};

EOSIO_REFLECT(get_status_result_base, head, last_irreversible, trace_begin_block, trace_end_block,
chain_state_begin_block, chain_state_end_block)

struct get_status_result_v0 : get_status_result_base {
might_not_exist<eosio::checksum256> chain_id;
};

EOSIO_REFLECT(get_status_result_v0, head, last_irreversible, trace_begin_block, trace_end_block,
chain_state_begin_block, chain_state_end_block, chain_id)
EOSIO_REFLECT(get_status_result_v0, base get_status_result_base, chain_id)

struct get_status_result_v1 : get_status_result_base {
eosio::checksum256 chain_id;
uint32_t finality_data_begin_block = {};
uint32_t finality_data_end_block = {};
};

EOSIO_REFLECT(get_status_result_v1, base get_status_result_base, chain_id, finality_data_begin_block, finality_data_end_block)

struct get_blocks_request_v0 {
uint32_t start_block_num = {};
Expand Down Expand Up @@ -126,7 +143,7 @@ namespace eosio { namespace ship_protocol {

EOSIO_REFLECT(get_blocks_ack_request_v0, num_messages)

using request = std::variant<get_status_request_v0, get_blocks_request_v0, get_blocks_ack_request_v0, get_blocks_request_v1>;
using request = std::variant<get_status_request_v0, get_blocks_request_v0, get_blocks_ack_request_v0, get_blocks_request_v1, get_status_request_v1>;

struct get_blocks_result_base {
block_position head = {};
Expand Down Expand Up @@ -374,7 +391,7 @@ namespace eosio { namespace ship_protocol {

EOSIO_REFLECT(signed_block, base signed_block_header, transactions, block_extensions)

using result = std::variant<get_status_result_v0, get_blocks_result_v0, get_blocks_result_v1>;
using result = std::variant<get_status_result_v0, get_blocks_result_v0, get_blocks_result_v1, get_status_result_v1>;

struct transaction_header {
eosio::time_point_sec expiration = {};
Expand Down

0 comments on commit fcfd189

Please sign in to comment.