diff --git a/src/api/controller/path/info.hpp b/src/api/controller/path/info.hpp index 9298194f..327e7a25 100644 --- a/src/api/controller/path/info.hpp +++ b/src/api/controller/path/info.hpp @@ -17,8 +17,9 @@ #include "oatpp/web/server/api/ApiController.hpp" #include "oatpp/core/macro/codegen.hpp" -#include "version.h" -#include "modal/meta/version.hpp" +#include "controller/ApiCoreInfo.hpp" +#include "modal/info/details.hpp" +#include "currency_core/currency_stat_info.h" #include OATPP_CODEGEN_BEGIN(ApiController) @@ -26,27 +27,197 @@ * Info Controller */ class InfoController : public oatpp::web::server::api::ApiController { +private: + OATPP_COMPONENT(std::shared_ptr, m_core_info); public: explicit InfoController(OATPP_COMPONENT(std::shared_ptr, objectMapper)) : oatpp::web::server::api::ApiController(objectMapper) {} public: - ENDPOINT_INFO(version) - { + ENDPOINT_INFO(getInfo) { + info->summary = "Get detailed information about the blockchain and daemon state"; info->addTag("Info"); - info->summary = "Get API version"; - info->description = "Returns the current version of the API."; - info->addResponse>(Status::CODE_200, "application/json"); + info->addResponse>(Status::CODE_200, "application/json"); + info->queryParams["flags"].name = "flags"; + info->queryParams["flags"].description = "Possible values: net_time_delta_median, current_network_hashrate_50, current_network_hashrate_350, seconds_for_10_blocks, seconds_for_30_blocks, transactions_daily_stat, last_pos_timestamp, last_pow_timestamp, total_coins, last_block_size, tx_count_in_last_block, pos_sequence_factor, pow_sequence_factor, pos_difficulty, performance, outs_stat, expirations_median."; } - ENDPOINT("GET", "/info/version", version) - { - auto model = VersionModel::createShared(); - model->version = PROJECT_VERSION; - model->version_long = PROJECT_VERSION_LONG; - model->major = PROJECT_MAJOR_VERSION; - model->minor = PROJECT_MINOR_VERSION; - model->revision = PROJECT_REVISION; + ENDPOINT("GET", "/info", getInfo, QUERY(String, flags, "flags",""), QUERIES(QueryParams, queryParams)) { + auto model = InfoModel::createShared(); + currency::core& core = m_core_info->getCore(); + currency::t_currency_protocol_handler& p2p_handler = m_core_info->getP2p().get_payload_object(); + currency::blockchain_storage& bcs = core.get_blockchain_storage(); + + model->height = bcs.get_current_blockchain_size(); + model->tx_count = bcs.get_total_transactions() - model->height; //without coinbase + model->tx_pool_size = core.get_pool_transactions_count(); + model->alt_blocks_count = bcs.get_alternative_blocks_count(); + uint64_t total_conn = m_core_info->getP2p().get_connections_count(); + model->outgoing_connections_count = m_core_info->getP2p().get_outgoing_connections_count(); + model->incoming_connections_count = total_conn - model->outgoing_connections_count; + model->synchronized_connections_count = p2p_handler.get_synchronized_connections_count(); + model->white_peerlist_size = m_core_info->getP2p().get_peerlist_manager().get_white_peers_count(); + model->grey_peerlist_size = m_core_info->getP2p().get_peerlist_manager().get_gray_peers_count(); + model->current_blocks_median = bcs.get_current_comulative_blocksize_limit() / 2; + model->alias_count = bcs.get_aliases_count(); + model->current_max_allowed_block_size = bcs.get_current_comulative_blocksize_limit(); + + if (!model->outgoing_connections_count) + model->daemon_network_state = "connecting"; + else if (p2p_handler.is_synchronized()) + model->daemon_network_state = "online"; + else + model->daemon_network_state = "synchronizing"; + + model->synchronization_start_height = p2p_handler.get_core_inital_height(); + model->max_net_seen_height = p2p_handler.get_max_seen_height(); + + nodetool::maintainers_info_external mi_res; + m_core_info->getP2p().get_maintainers_info(mi_res); + auto mi_model = MaintainersInfoModel::createShared(); + mi_model->ver_major = mi_res.ver_major; + mi_model->ver_minor = mi_res.ver_minor; + mi_model->ver_revision = mi_res.ver_revision; + mi_model->build_no = mi_res.build_no; + mi_model->mode = mi_res.mode; + model->mi = mi_model; + + model->pos_allowed = bcs.is_pos_allowed(); + model->pos_difficulty = bcs.get_cached_next_difficulty(true).convert_to(); + model->pow_difficulty = bcs.get_cached_next_difficulty(false).convert_to(); + model->default_fee = bcs.get_core_runtime_config().tx_default_fee; + model->minimum_fee = bcs.get_core_runtime_config().tx_pool_min_fee; + + auto hf_list = oatpp::List::createShared(); + for (size_t i = 0; i != ZANO_HARDFORKS_TOTAL; i++) + { + hf_list->push_back(bcs.is_hardfork_active(i)); + } + model->is_hardfork_active = hf_list; + + auto flagsStr = queryParams.get("flags"); + if (flagsStr) { + std::istringstream iss(flagsStr->c_str()); + std::string flag; + while (std::getline(iss, flag, ',')) { + if (flag == "net_time_delta_median") { + int64_t last_median2local_time_diff, last_ntp2local_time_diff; + if (!p2p_handler.get_last_time_sync_difference(last_median2local_time_diff, last_ntp2local_time_diff)) + model->net_time_delta_median = 1; + } else if (flag == "current_network_hashrate_50") { + model->current_network_hashrate_50 = bcs.get_current_hashrate(50); + } else if (flag == "current_network_hashrate_350") { + model->current_network_hashrate_350 = bcs.get_current_hashrate(350); + } else if (flag == "seconds_for_10_blocks") { + model->seconds_for_10_blocks = bcs.get_seconds_between_last_n_block(10); + } else if (flag == "seconds_for_30_blocks") { + model->seconds_for_30_blocks = bcs.get_seconds_between_last_n_block(30); + } else if (flag == "transactions_daily_stat") { + uint64_t daily_tx_count = 0, daily_tx_vol = 0; + bcs.get_transactions_daily_stat(daily_tx_count, daily_tx_vol); + auto daily_tx_count_list = oatpp::List::createShared(); + daily_tx_count_list->push_back(daily_tx_count); + model->transactions_cnt_per_day = daily_tx_count_list; + auto daily_tx_vol_list = oatpp::List::createShared(); + daily_tx_vol_list->push_back(daily_tx_vol); + model->transactions_volume_per_day = daily_tx_vol_list; + } else if (flag == "last_pos_timestamp") { + auto pos_bl_ptr = bcs.get_last_block_of_type(true); + if (pos_bl_ptr) model->last_pos_timestamp = pos_bl_ptr->bl.timestamp; + } else if (flag == "last_pow_timestamp") { + auto pow_bl_ptr = bcs.get_last_block_of_type(false); + if (pow_bl_ptr) model->last_pow_timestamp = pow_bl_ptr->bl.timestamp; + } else if (flag == "total_coins") { + model->total_coins = boost::lexical_cast(bcs.total_coins()); + } else if (flag == "last_block_size") { + std::vector sz; + bcs.get_last_n_blocks_sizes(sz, 1); + model->last_block_size = sz.size() ? sz.back() : 0; + } else if (flag == "tx_count_in_last_block") { + currency::block b = AUTO_VAL_INIT(b); + bcs.get_top_block(b); + model->tx_count_in_last_block = b.tx_hashes.size(); + } else if (flag == "pos_sequence_factor") { + model->pos_sequence_factor = bcs.get_current_sequence_factor(true); + } else if (flag == "pow_sequence_factor") { + model->pow_sequence_factor = bcs.get_current_sequence_factor(false); + } else if (flag == "pos_difficulty") { + currency::block b = AUTO_VAL_INIT(b); + bcs.get_top_block(b); + model->block_reward = currency::get_base_block_reward(model->height); + model->last_block_total_reward = currency::get_reward_from_miner_tx(b.miner_tx); + model->pos_diff_total_coins_rate = (bcs.get_cached_next_difficulty(true) / (bcs.total_coins() - PREMINE_AMOUNT + 1)).convert_to(); + model->last_block_timestamp = b.timestamp; + model->last_block_hash = string_tools::pod_to_hex(get_block_hash(b)); + } else if (flag == "performance") { + auto perf_model = PerformanceModel::createShared(); + const currency::blockchain_storage::performnce_data& pd = bcs.get_performnce_data(); + auto block_processing_model = BlockProcessingPerformanceModel::createShared(); + block_processing_model->block_processing_time_0 = pd.block_processing_time_0_ms.get_avg(); + block_processing_model->block_processing_time_1 = pd.block_processing_time_1.get_avg(); + block_processing_model->target_calculating_time_2 = pd.target_calculating_time_2.get_avg(); + block_processing_model->longhash_calculating_time_3 = pd.longhash_calculating_time_3.get_avg(); + block_processing_model->all_txs_insert_time_5 = pd.all_txs_insert_time_5.get_avg(); + block_processing_model->etc_stuff_6 = pd.etc_stuff_6.get_avg(); + block_processing_model->insert_time_4 = pd.insert_time_4.get_avg(); + block_processing_model->raise_block_core_event = pd.raise_block_core_event.get_avg(); + block_processing_model->target_calculating_enum_blocks = pd.target_calculating_enum_blocks.get_avg(); + block_processing_model->target_calculating_calc = pd.target_calculating_calc.get_avg(); + perf_model->block_processing = block_processing_model; + + auto tx_processing_model = TxProcessingPerformanceModel::createShared(); + tx_processing_model->tx_check_inputs = pd.tx_check_inputs_time.get_avg(); + tx_processing_model->tx_add_one_tx = pd.tx_add_one_tx_time.get_avg(); + tx_processing_model->tx_process_extra = pd.tx_process_extra.get_avg(); + tx_processing_model->tx_process_attachment = pd.tx_process_attachment.get_avg(); + tx_processing_model->tx_process_inputs = pd.tx_process_inputs.get_avg(); + tx_processing_model->tx_push_global_index = pd.tx_push_global_index.get_avg(); + tx_processing_model->tx_check_exist = pd.tx_check_exist.get_avg(); + tx_processing_model->tx_append = pd.tx_append_time.get_avg(); + tx_processing_model->tx_append_rl_wait = pd.tx_append_rl_wait.get_avg(); + tx_processing_model->tx_append_is_expired = pd.tx_append_is_expired.get_avg(); + tx_processing_model->tx_store_db = pd.tx_store_db.get_avg(); + tx_processing_model->tx_check_inputs_prefix_hash = pd.tx_check_inputs_prefix_hash.get_avg(); + tx_processing_model->tx_check_inputs_attachment_check = pd.tx_check_inputs_attachment_check.get_avg(); + tx_processing_model->tx_check_inputs_loop = pd.tx_check_inputs_loop.get_avg(); + tx_processing_model->tx_check_inputs_loop_kimage_check = pd.tx_check_inputs_loop_kimage_check.get_avg(); + tx_processing_model->tx_check_inputs_loop_ch_in_val_sig = pd.tx_check_inputs_loop_ch_in_val_sig.get_avg(); + tx_processing_model->tx_check_inputs_loop_scan_outputkeys_get_item_size = pd.tx_check_inputs_loop_scan_outputkeys_get_item_size.get_avg(); + tx_processing_model->tx_check_inputs_loop_scan_outputkeys_relative_to_absolute = pd.tx_check_inputs_loop_scan_outputkeys_relative_to_absolute.get_avg(); + tx_processing_model->tx_check_inputs_loop_scan_outputkeys_loop = pd.tx_check_inputs_loop_scan_outputkeys_loop.get_avg(); + tx_processing_model->tx_check_inputs_loop_scan_outputkeys_loop_get_subitem = pd.tx_check_inputs_loop_scan_outputkeys_loop_get_subitem.get_avg(); + tx_processing_model->tx_check_inputs_loop_scan_outputkeys_loop_find_tx = pd.tx_check_inputs_loop_scan_outputkeys_loop_find_tx.get_avg(); + tx_processing_model->tx_check_inputs_loop_scan_outputkeys_loop_handle_output = pd.tx_check_inputs_loop_scan_outputkeys_loop_handle_output.get_avg(); + tx_processing_model->tx_mixin_count = pd.tx_mixin_count.get_avg(); + perf_model->tx_processing = tx_processing_model; + + const currency::tx_memory_pool::performnce_data& pool_pd = core.get_tx_pool().get_performnce_data(); + auto tx_pool_model = TxPoolPerformanceModel::createShared(); + tx_pool_model->tx_processing_time = pool_pd.tx_processing_time.get_avg(); + tx_pool_model->check_inputs_types_supported_time = pool_pd.check_inputs_types_supported_time.get_avg(); + tx_pool_model->expiration_validate_time = pool_pd.expiration_validate_time.get_avg(); + tx_pool_model->validate_amount_time = pool_pd.validate_amount_time.get_avg(); + tx_pool_model->validate_alias_time = pool_pd.validate_alias_time.get_avg(); + tx_pool_model->check_keyimages_ws_ms_time = pool_pd.check_keyimages_ws_ms_time.get_avg(); + tx_pool_model->check_inputs_time = pool_pd.check_inputs_time.get_avg(); + tx_pool_model->begin_tx_time = pool_pd.begin_tx_time.get_avg(); + tx_pool_model->update_db_time = pool_pd.update_db_time.get_avg(); + tx_pool_model->db_commit_time = pool_pd.db_commit_time.get_avg(); + perf_model->tx_pool = tx_pool_model; + + auto db_stat_model = DbStatInfoModel::createShared(); + db_stat_model->map_size = pd.si.map_size; + db_stat_model->tx_count = pd.si.tx_count; + db_stat_model->write_tx_count = pd.si.write_tx_count; + perf_model->db_stat_info = db_stat_model; + + model->performance_data = perf_model; + } else if (flag == "expirations_median") { + model->expiration_median_timestamp = bcs.get_tx_expiration_median(); + } + } + } + return createDtoResponse(Status::CODE_200, model); } diff --git a/src/api/modal/block/details.hpp b/src/api/modal/block/details.hpp index 865c12d2..d4803b58 100644 --- a/src/api/modal/block/details.hpp +++ b/src/api/modal/block/details.hpp @@ -15,7 +15,7 @@ #ifndef BlockDetailsModel_hpp #define BlockDetailsModel_hpp -#include "../transaction/details.hpp" +#include "modal/transaction/details.hpp" #include "oatpp/core/macro/codegen.hpp" #include "oatpp/core/Types.hpp" diff --git a/src/api/modal/info/details.hpp b/src/api/modal/info/details.hpp new file mode 100644 index 00000000..58b3c073 --- /dev/null +++ b/src/api/modal/info/details.hpp @@ -0,0 +1,79 @@ +// Copyright (c) 2017-2025 Lethean (https://lt.hn) +// +// Licensed under the European Union Public Licence (EUPL) version 1.2. +// You may obtain a copy of the licence at: +// +// https://joinup.ec.europa.eu/software/page/eupl/licence-eupl +// +// The EUPL is a copyleft licence that is compatible with the MIT/X11 +// licence used by the original projects; but maintains OSS status, +// where regional copyright law requires ownership to dictate licence terms. +// +// SPDX‑License‑Identifier: EUPL-1.2 +// + +#ifndef InfoModel_hpp +#define InfoModel_hpp + +#include "maintainers_info.hpp" +#include "modal/meta/performance.hpp" +#include "oatpp/core/macro/codegen.hpp" +#include "oatpp/core/Types.hpp" + +#include OATPP_CODEGEN_BEGIN(DTO) + +class InfoModel final : public oatpp::DTO +{ + DTO_INIT(InfoModel, DTO); + + DTO_FIELD(UInt64, height); + DTO_FIELD(UInt64, tx_count); + DTO_FIELD(UInt64, tx_pool_size); + DTO_FIELD(UInt64, alt_blocks_count); + DTO_FIELD(UInt64, outgoing_connections_count); + DTO_FIELD(UInt64, incoming_connections_count); + DTO_FIELD(UInt64, synchronized_connections_count); + DTO_FIELD(UInt64, white_peerlist_size); + DTO_FIELD(UInt64, grey_peerlist_size); + DTO_FIELD(UInt64, current_blocks_median); + DTO_FIELD(UInt64, alias_count); + DTO_FIELD(UInt64, current_max_allowed_block_size); + DTO_FIELD(String, daemon_network_state); + DTO_FIELD(UInt64, synchronization_start_height); + DTO_FIELD(UInt64, max_net_seen_height); + DTO_FIELD(Object, mi); + DTO_FIELD(Boolean, pos_allowed); + DTO_FIELD(String, pos_difficulty); + DTO_FIELD(UInt64, pow_difficulty); + DTO_FIELD(UInt64, default_fee); + DTO_FIELD(UInt64, minimum_fee); + DTO_FIELD(List, is_hardfork_active); + DTO_FIELD(Int64, net_time_delta_median); + DTO_FIELD(UInt64, current_network_hashrate_50); + DTO_FIELD(UInt64, current_network_hashrate_350); + DTO_FIELD(UInt64, seconds_for_10_blocks); + DTO_FIELD(UInt64, seconds_for_30_blocks); + DTO_FIELD(List, transactions_cnt_per_day); + DTO_FIELD(List, transactions_volume_per_day); + DTO_FIELD(UInt64, last_pos_timestamp); + DTO_FIELD(UInt64, last_pow_timestamp); + DTO_FIELD(String, total_coins); + DTO_FIELD(UInt64, last_block_size); + DTO_FIELD(UInt64, tx_count_in_last_block); + DTO_FIELD(Float64, pos_sequence_factor); + DTO_FIELD(Float64, pow_sequence_factor); + DTO_FIELD(UInt64, block_reward); + DTO_FIELD(UInt64, last_block_total_reward); + DTO_FIELD(UInt64, pos_diff_total_coins_rate); + DTO_FIELD(UInt64, last_block_timestamp); + DTO_FIELD(String, last_block_hash); + DTO_FIELD(Int64, pos_block_ts_shift_vs_actual); + DTO_FIELD(Fields, outs_stat); // Represents a map of uint64_t to uint64_t + DTO_FIELD(Object, performance_data); + DTO_FIELD(UInt64, offers_count); + DTO_FIELD(UInt64, expiration_median_timestamp); +}; + +#include OATPP_CODEGEN_END(DTO) + +#endif /* InfoModel_hpp */ diff --git a/src/api/modal/info/maintainers_info.hpp b/src/api/modal/info/maintainers_info.hpp new file mode 100644 index 00000000..56e2bd13 --- /dev/null +++ b/src/api/modal/info/maintainers_info.hpp @@ -0,0 +1,36 @@ +// Copyright (c) 2017-2025 Lethean (https://lt.hn) +// +// Licensed under the European Union Public Licence (EUPL) version 1.2. +// You may obtain a copy of the licence at: +// +// https://joinup.ec.europa.eu/software/page/eupl/licence-eupl +// +// The EUPL is a copyleft licence that is compatible with the MIT/X11 +// licence used by the original projects; but maintains OSS status, +// where regional copyright law requires ownership to dictate licence terms. +// +// SPDX‑License‑Identifier: EUPL-1.2 +// + +#ifndef MaintainersInfoModel_hpp +#define MaintainersInfoModel_hpp + +#include "oatpp/core/macro/codegen.hpp" +#include "oatpp/core/Types.hpp" + +#include OATPP_CODEGEN_BEGIN(DTO) + +class MaintainersInfoModel final : public oatpp::DTO +{ + DTO_INIT(MaintainersInfoModel, DTO); + + DTO_FIELD(UInt8, ver_major); + DTO_FIELD(UInt8, ver_minor); + DTO_FIELD(UInt8, ver_revision); + DTO_FIELD(UInt32, build_no); + DTO_FIELD(UInt8, mode); +}; + +#include OATPP_CODEGEN_END(DTO) + +#endif /* MaintainersInfoModel_hpp */ diff --git a/src/api/modal/meta/db_stat_info.hpp b/src/api/modal/meta/db_stat_info.hpp new file mode 100644 index 00000000..be080557 --- /dev/null +++ b/src/api/modal/meta/db_stat_info.hpp @@ -0,0 +1,34 @@ +// Copyright (c) 2017-2025 Lethean (https://lt.hn) +// +// Licensed under the European Union Public Licence (EUPL) version 1.2. +// You may obtain a copy of the licence at: +// +// https://joinup.ec.europa.eu/software/page/eupl/licence-eupl +// +// The EUPL is a copyleft licence that is compatible with the MIT/X11 +// licence used by the original projects; but maintains OSS status, +// where regional copyright law requires ownership to dictate licence terms. +// +// SPDX‑License‑Identifier: EUPL-1.2 +// + +#ifndef DbStatInfoModel_hpp +#define DbStatInfoModel_hpp + +#include "oatpp/core/macro/codegen.hpp" +#include "oatpp/core/Types.hpp" + +#include OATPP_CODEGEN_BEGIN(DTO) + +class DbStatInfoModel final : public oatpp::DTO +{ + DTO_INIT(DbStatInfoModel, DTO); + + DTO_FIELD(UInt64, tx_count); + DTO_FIELD(UInt64, write_tx_count); + DTO_FIELD(UInt64, map_size); +}; + +#include OATPP_CODEGEN_END(DTO) + +#endif /* DbStatInfoModel_hpp */ diff --git a/src/api/modal/meta/performance.hpp b/src/api/modal/meta/performance.hpp new file mode 100644 index 00000000..bed1c8c9 --- /dev/null +++ b/src/api/modal/meta/performance.hpp @@ -0,0 +1,39 @@ +// Copyright (c) 2017-2025 Lethean (https://lt.hn) +// +// Licensed under the European Union Public Licence (EUPL) version 1.2. +// You may obtain a copy of the licence at: +// +// https://joinup.ec.europa.eu/software/page/eupl/licence-eupl +// +// The EUPL is a copyleft licence that is compatible with the MIT/X11 +// licence used by the original projects; but maintains OSS status, +// where regional copyright law requires ownership to dictate licence terms. +// +// SPDX‑License‑Identifier: EUPL-1.2 +// + +#ifndef PerformanceModel_hpp +#define PerformanceModel_hpp + +#include "performance/block_processing.hpp" +#include "performance/tx_processing.hpp" +#include "performance/tx_pool.hpp" +#include "db_stat_info.hpp" +#include "oatpp/core/macro/codegen.hpp" +#include "oatpp/core/Types.hpp" + +#include OATPP_CODEGEN_BEGIN(DTO) + +class PerformanceModel final : public oatpp::DTO +{ + DTO_INIT(PerformanceModel, DTO); + + DTO_FIELD(Object, block_processing); + DTO_FIELD(Object, tx_processing); + DTO_FIELD(Object, tx_pool); + DTO_FIELD(Object, db_stat_info); +}; + +#include OATPP_CODEGEN_END(DTO) + +#endif /* PerformanceModel_hpp */ diff --git a/src/api/modal/meta/performance/block_processing.hpp b/src/api/modal/meta/performance/block_processing.hpp new file mode 100644 index 00000000..965db793 --- /dev/null +++ b/src/api/modal/meta/performance/block_processing.hpp @@ -0,0 +1,47 @@ +// Copyright (c) 2017-2025 Lethean (https://lt.hn) +// +// Licensed under the European Union Public Licence (EUPL) version 1.2. +// You may obtain a copy of the licence at: +// +// https://joinup.ec.europa.eu/software/page/eupl/licence-eupl +// +// The EUPL is a copyleft licence that is compatible with the MIT/X11 +// licence used by the original projects; but maintains OSS status, +// where regional copyright law requires ownership to dictate licence terms. +// +// SPDX‑License‑Identifier: EUPL-1.2 +// + +#ifndef BlockProcessingPerformanceModel_hpp +#define BlockProcessingPerformanceModel_hpp + +#include "oatpp/core/macro/codegen.hpp" +#include "oatpp/core/Types.hpp" + +#include OATPP_CODEGEN_BEGIN(DTO) + +class BlockProcessingPerformanceModel final : public oatpp::DTO +{ + DTO_INIT(BlockProcessingPerformanceModel, DTO); + + DTO_FIELD(UInt64, block_processing_time_0); + DTO_FIELD(UInt64, block_processing_time_1); + DTO_FIELD(UInt64, target_calculating_time_2); + DTO_FIELD(UInt64, longhash_calculating_time_3); + DTO_FIELD(UInt64, all_txs_insert_time_5); + DTO_FIELD(UInt64, etc_stuff_6); + DTO_FIELD(UInt64, insert_time_4); + DTO_FIELD(UInt64, raise_block_core_event); + DTO_FIELD(UInt64, validate_miner_transaction_time); + DTO_FIELD(UInt64, collect_rangeproofs_data_from_tx_time); + DTO_FIELD(UInt64, verify_multiple_zc_outs_range_proofs_time); + DTO_FIELD(UInt64, target_calculating_enum_blocks); + DTO_FIELD(UInt64, target_calculating_calc); + DTO_FIELD(UInt64, pos_validate_ki_search); + DTO_FIELD(UInt64, pos_validate_get_out_keys_for_inputs); + DTO_FIELD(UInt64, pos_validate_zvp); +}; + +#include OATPP_CODEGEN_END(DTO) + +#endif /* BlockProcessingPerformanceModel_hpp */ diff --git a/src/api/modal/meta/performance/tx_pool.hpp b/src/api/modal/meta/performance/tx_pool.hpp new file mode 100644 index 00000000..31cda6f1 --- /dev/null +++ b/src/api/modal/meta/performance/tx_pool.hpp @@ -0,0 +1,42 @@ +// Copyright (c) 2017-2025 Lethean (https://lt.hn) +// +// Licensed under the European Union Public Licence (EUPL) version 1.2. +// You may obtain a copy of the licence at: +// +// https://joinup.ec.europa.eu/software/page/eupl/licence-eupl +// +// The EUPL is a copyleft licence that is compatible with the MIT/X11 +// licence used by the original projects; but maintains OSS status, +// where regional copyright law requires ownership to dictate licence terms. +// +// SPDX‑License‑Identifier: EUPL-1.2 +// + +#ifndef TxPoolPerformanceModel_hpp +#define TxPoolPerformanceModel_hpp + +#include "oatpp/core/macro/codegen.hpp" +#include "oatpp/core/Types.hpp" + +#include OATPP_CODEGEN_BEGIN(DTO) + +class TxPoolPerformanceModel final : public oatpp::DTO +{ + DTO_INIT(TxPoolPerformanceModel, DTO); + + DTO_FIELD(UInt64, tx_processing_time); + DTO_FIELD(UInt64, check_inputs_types_supported_time); + DTO_FIELD(UInt64, expiration_validate_time); + DTO_FIELD(UInt64, validate_amount_time); + DTO_FIELD(UInt64, validate_alias_time); + DTO_FIELD(UInt64, check_keyimages_ws_ms_time); + DTO_FIELD(UInt64, check_inputs_time); + DTO_FIELD(UInt64, begin_tx_time); + DTO_FIELD(UInt64, update_db_time); + DTO_FIELD(UInt64, db_commit_time); + DTO_FIELD(UInt64, check_post_hf4_balance); +}; + +#include OATPP_CODEGEN_END(DTO) + +#endif /* TxPoolPerformanceModel_hpp */ diff --git a/src/api/modal/meta/performance/tx_processing.hpp b/src/api/modal/meta/performance/tx_processing.hpp new file mode 100644 index 00000000..97aacebc --- /dev/null +++ b/src/api/modal/meta/performance/tx_processing.hpp @@ -0,0 +1,56 @@ +// Copyright (c) 2017-2025 Lethean (https://lt.hn) +// +// Licensed under the European Union Public Licence (EUPL) version 1.2. +// You may obtain a copy of the licence at: +// +// https://joinup.ec.europa.eu/software/page/eupl/licence-eupl +// +// The EUPL is a copyleft licence that is compatible with the MIT/X11 +// licence used by the original projects; but maintains OSS status, +// where regional copyright law requires ownership to dictate licence terms. +// +// SPDX‑License‑Identifier: EUPL-1.2 +// + +#ifndef TxProcessingPerformanceModel_hpp +#define TxProcessingPerformanceModel_hpp + +#include "oatpp/core/macro/codegen.hpp" +#include "oatpp/core/Types.hpp" + +#include OATPP_CODEGEN_BEGIN(DTO) + +class TxProcessingPerformanceModel final : public oatpp::DTO +{ + DTO_INIT(TxProcessingPerformanceModel, DTO); + + DTO_FIELD(UInt64, tx_check_inputs); + DTO_FIELD(UInt64, tx_add_one_tx); + DTO_FIELD(UInt64, tx_process_extra); + DTO_FIELD(UInt64, tx_process_attachment); + DTO_FIELD(UInt64, tx_process_inputs); + DTO_FIELD(UInt64, tx_push_global_index); + DTO_FIELD(UInt64, tx_check_exist); + DTO_FIELD(UInt64, tx_print_log); + DTO_FIELD(UInt64, tx_prapare_append); + DTO_FIELD(UInt64, tx_append); + DTO_FIELD(UInt64, tx_append_rl_wait); + DTO_FIELD(UInt64, tx_append_is_expired); + DTO_FIELD(UInt64, tx_store_db); + DTO_FIELD(UInt64, tx_check_inputs_prefix_hash); + DTO_FIELD(UInt64, tx_check_inputs_attachment_check); + DTO_FIELD(UInt64, tx_check_inputs_loop); + DTO_FIELD(UInt64, tx_check_inputs_loop_kimage_check); + DTO_FIELD(UInt64, tx_check_inputs_loop_ch_in_val_sig); + DTO_FIELD(UInt64, tx_check_inputs_loop_scan_outputkeys_get_item_size); + DTO_FIELD(UInt64, tx_check_inputs_loop_scan_outputkeys_relative_to_absolute); + DTO_FIELD(UInt64, tx_check_inputs_loop_scan_outputkeys_loop); + DTO_FIELD(UInt64, tx_check_inputs_loop_scan_outputkeys_loop_get_subitem); + DTO_FIELD(UInt64, tx_check_inputs_loop_scan_outputkeys_loop_find_tx); + DTO_FIELD(UInt64, tx_check_inputs_loop_scan_outputkeys_loop_handle_output); + DTO_FIELD(UInt64, tx_mixin_count); +}; + +#include OATPP_CODEGEN_END(DTO) + +#endif /* TxProcessingPerformanceModel_hpp */