diff --git a/plugins/chain_api_plugin/chain.swagger.yaml b/plugins/chain_api_plugin/chain.swagger.yaml index 08d831fad0..5bef6ef0d0 100644 --- a/plugins/chain_api_plugin/chain.swagger.yaml +++ b/plugins/chain_api_plugin/chain.swagger.yaml @@ -186,30 +186,6 @@ paths: schema: description: Returns Nothing - /get_block_header_state: - post: - description: Retrieves the glock header state - operationId: get_block_header_state - requestBody: - content: - application/json: - schema: - type: object - required: - - block_num_or_id - properties: - block_num_or_id: - type: string - description: Provide a block_number or a block_id - - responses: - "200": - description: OK - content: - application/json: - schema: - $ref: "https://docs.eosnetwork.com/openapi/v2.0/BlockHeaderState.yaml" - /get_abi: post: description: Retrieves the ABI for a contract based on its account name diff --git a/plugins/chain_api_plugin/chain_api_plugin.cpp b/plugins/chain_api_plugin/chain_api_plugin.cpp index 1fc626d9e8..4d5b6c85c8 100644 --- a/plugins/chain_api_plugin/chain_api_plugin.cpp +++ b/plugins/chain_api_plugin/chain_api_plugin.cpp @@ -132,7 +132,6 @@ void chain_api_plugin::plugin_startup() { CHAIN_RO_CALL(get_activated_protocol_features, 200, http_params_types::possible_no_params), CHAIN_RO_CALL_POST(get_block, fc::variant, 200, http_params_types::params_required), // _POST because get_block() returns a lambda to be executed on the http thread pool CHAIN_RO_CALL(get_block_info, 200, http_params_types::params_required), - CHAIN_RO_CALL(get_block_header_state, 200, http_params_types::params_required), CHAIN_RO_CALL_POST(get_account, chain_apis::read_only::get_account_results, 200, http_params_types::params_required), CHAIN_RO_CALL(get_code, 200, http_params_types::params_required), CHAIN_RO_CALL(get_code_hash, 200, http_params_types::params_required), diff --git a/plugins/chain_plugin/chain_plugin.cpp b/plugins/chain_plugin/chain_plugin.cpp index af7719b061..98af496a53 100644 --- a/plugins/chain_plugin/chain_plugin.cpp +++ b/plugins/chain_plugin/chain_plugin.cpp @@ -2011,29 +2011,6 @@ fc::variant read_only::get_block_info(const read_only::get_block_info_params& pa ("ref_block_prefix", ref_block_prefix); } -fc::variant read_only::get_block_header_state(const get_block_header_state_params& params, const fc::time_point&) const { - block_state_legacy_ptr b; - std::optional block_num; - std::exception_ptr e; - try { - block_num = fc::to_uint64(params.block_num_or_id); - } catch( ... ) {} - - if( block_num ) { - b = db.fetch_block_state_by_number(*block_num); - } else { - try { - b = db.fetch_block_state_by_id(fc::variant(params.block_num_or_id).as()); - } EOS_RETHROW_EXCEPTIONS(chain::block_id_type_exception, "Invalid block ID: ${block_num_or_id}", ("block_num_or_id", params.block_num_or_id)) - } - - EOS_ASSERT( b, unknown_block_exception, "Could not find reversible block: ${block}", ("block", params.block_num_or_id)); - - fc::variant vo; - fc::to_variant( static_cast(*b), vo ); - return vo; -} - void read_write::push_block(read_write::push_block_params&& params, next_function next) { try { app().get_method()(std::make_shared( std::move(params) ), std::optional{}, block_state_legacy_ptr{}); diff --git a/plugins/chain_plugin/include/eosio/chain_plugin/chain_plugin.hpp b/plugins/chain_plugin/include/eosio/chain_plugin/chain_plugin.hpp index 39c48d3bfe..cd1fd5b0aa 100644 --- a/plugins/chain_plugin/include/eosio/chain_plugin/chain_plugin.hpp +++ b/plugins/chain_plugin/include/eosio/chain_plugin/chain_plugin.hpp @@ -409,12 +409,6 @@ class read_only : public api_base { fc::variant get_block_info(const get_block_info_params& params, const fc::time_point& deadline) const; - struct get_block_header_state_params { - string block_num_or_id; - }; - - fc::variant get_block_header_state(const get_block_header_state_params& params, const fc::time_point& deadline) const; - struct get_table_rows_params { bool json = false; name code; @@ -1067,7 +1061,6 @@ FC_REFLECT(eosio::chain_apis::read_only::get_activated_protocol_features_params, FC_REFLECT(eosio::chain_apis::read_only::get_activated_protocol_features_results, (activated_protocol_features)(more) ) FC_REFLECT(eosio::chain_apis::read_only::get_raw_block_params, (block_num_or_id)) FC_REFLECT(eosio::chain_apis::read_only::get_block_info_params, (block_num)) -FC_REFLECT(eosio::chain_apis::read_only::get_block_header_state_params, (block_num_or_id)) FC_REFLECT(eosio::chain_apis::read_only::get_block_header_params, (block_num_or_id)(include_extensions)) FC_REFLECT(eosio::chain_apis::read_only::get_block_header_result, (id)(signed_block_header)(block_extensions)) diff --git a/programs/cleos/httpc.hpp b/programs/cleos/httpc.hpp index 27b3ed3eb9..bae87d2b8d 100644 --- a/programs/cleos/httpc.hpp +++ b/programs/cleos/httpc.hpp @@ -34,7 +34,6 @@ namespace eosio { namespace client { namespace http { const string get_raw_block_func = chain_func_base + "/get_raw_block"; const string get_block_header_func = chain_func_base + "/get_block_header"; const string get_block_info_func = chain_func_base + "/get_block_info"; - const string get_block_header_state_func = chain_func_base + "/get_block_header_state"; const string get_account_func = chain_func_base + "/get_account"; const string get_table_func = chain_func_base + "/get_table_rows"; const string get_table_by_scope_func = chain_func_base + "/get_table_by_scope"; diff --git a/programs/cleos/main.cpp b/programs/cleos/main.cpp index 819d736426..cc3e0484f2 100644 --- a/programs/cleos/main.cpp +++ b/programs/cleos/main.cpp @@ -3016,7 +3016,6 @@ int main( int argc, char** argv ) { get_block_params params; auto getBlock = get->add_subcommand("block", localized("Retrieve a full block from the blockchain")); getBlock->add_option("block", params.blockArg, localized("The number or ID of the block to retrieve"))->required(); - getBlock->add_flag("--header-state", params.get_bhs, localized("Get block header state from fork database instead") ); getBlock->add_flag("--info", params.get_binfo, localized("Get block info from the blockchain by block num only") ); getBlock->add_flag("--raw", params.get_braw, localized("Get raw block from the blockchain") ); getBlock->add_flag("--header", params.get_bheader, localized("Get block header from the blockchain") ); @@ -3024,7 +3023,7 @@ int main( int argc, char** argv ) { getBlock->callback([¶ms] { int num_flags = params.get_bhs + params.get_binfo + params.get_braw + params.get_bheader + params.get_bheader_extensions; - EOSC_ASSERT( num_flags <= 1, "ERROR: Only one of the following flags can be set: --header-state, --info, --raw, --header, --header-with-extensions." ); + EOSC_ASSERT( num_flags <= 1, "ERROR: Only one of the following flags can be set: --info, --raw, --header, --header-with-extensions." ); if (params.get_binfo) { std::optional block_num; try { @@ -3037,9 +3036,7 @@ int main( int argc, char** argv ) { std::cout << fc::json::to_pretty_string(call(get_block_info_func, arg)) << std::endl; } else { const auto arg = fc::variant_object("block_num_or_id", params.blockArg); - if (params.get_bhs) { - std::cout << fc::json::to_pretty_string(call(get_block_header_state_func, arg)) << std::endl; - } else if (params.get_braw) { + if (params.get_braw) { std::cout << fc::json::to_pretty_string(call(get_raw_block_func, arg)) << std::endl; } else if (params.get_bheader || params.get_bheader_extensions) { std::cout << fc::json::to_pretty_string( diff --git a/tests/plugin_http_api_test.py b/tests/plugin_http_api_test.py index c11a5cc21f..f9628847cc 100755 --- a/tests/plugin_http_api_test.py +++ b/tests/plugin_http_api_test.py @@ -336,25 +336,6 @@ def test_ChainApi(self) : ret_json = self.nodeos.processUrllibRequest(resource, command, payload, endpoint=endpoint) self.assertEqual(ret_json["payload"]["block_num"], 1) - # get_block_header_state with empty parameter - command = "get_block_header_state" - ret_json = self.nodeos.processUrllibRequest(resource, command, endpoint=endpoint) - self.assertEqual(ret_json["code"], 400) - self.assertEqual(ret_json["error"]["code"], 3200006) - # get_block_header_state with empty content parameter - ret_json = self.nodeos.processUrllibRequest(resource, command, self.empty_content_dict, endpoint=endpoint) - self.assertEqual(ret_json["code"], 400) - self.assertEqual(ret_json["error"]["code"], 3200006) - # get_block_header_state with invalid parameter - ret_json = self.nodeos.processUrllibRequest(resource, command, self.http_post_invalid_param, endpoint=endpoint) - self.assertEqual(ret_json["code"], 400) - self.assertEqual(ret_json["error"]["code"], 3200006) - # get_block_header_state with valid parameter, the irreversible is not available, unknown block number - payload = {"block_num_or_id":1} - ret_json = self.nodeos.processUrllibRequest(resource, command, payload, endpoint=endpoint) - self.assertEqual(ret_json["code"], 400) - self.assertEqual(ret_json["error"]["code"], 3100002) - # get_account with empty parameter command = "get_account" ret_json = self.nodeos.processUrllibRequest(resource, command, endpoint=endpoint) diff --git a/unittests/chain_tests.cpp b/unittests/chain_tests.cpp index 70a6ea23fa..40e49e5a04 100644 --- a/unittests/chain_tests.cpp +++ b/unittests/chain_tests.cpp @@ -156,10 +156,6 @@ BOOST_AUTO_TEST_CASE( signal_validated_blocks ) try { const auto& [ block, id ] = t; auto block_num = block->block_num(); BOOST_CHECK(block); - const auto& bsp_by_id = chain.control->fetch_block_state_by_id(id); - BOOST_CHECK(bsp_by_id->block_num() == block_num); - const auto& bsp_by_number = chain.control->fetch_block_state_by_number(block_num); // verify it can be found (has to be validated) - BOOST_CHECK(bsp_by_number->id() == id); BOOST_CHECK(chain.control->fetch_block_by_id(id) == block); BOOST_CHECK(chain.control->fetch_block_by_number(block_num) == block); BOOST_REQUIRE(chain.control->fetch_block_header_by_number(block_num)); @@ -175,10 +171,6 @@ BOOST_AUTO_TEST_CASE( signal_validated_blocks ) try { const auto& [ block, id ] = t; auto block_num = block->block_num(); BOOST_CHECK(block); - const auto& bsp_by_id = validator.control->fetch_block_state_by_id(id); - BOOST_CHECK(bsp_by_id->block_num() == block_num); - const auto& bsp_by_number = validator.control->fetch_block_state_by_number(block_num); // verify it can be found (has to be validated) - BOOST_CHECK(bsp_by_number->id() == id); BOOST_CHECK(validator.control->fetch_block_by_id(id) == block); BOOST_CHECK(validator.control->fetch_block_by_number(block_num) == block); BOOST_REQUIRE(validator.control->fetch_block_header_by_number(block_num));