mirror of
https://github.com/monero-project/monero.git
synced 2024-10-01 11:49:47 -04:00
rpc: add performance timers
Enable with perf:DEBUG
This commit is contained in:
parent
8d511f3c24
commit
4a17f0c2c7
@ -36,6 +36,7 @@ using namespace epee;
|
|||||||
#include "common/updates.h"
|
#include "common/updates.h"
|
||||||
#include "common/download.h"
|
#include "common/download.h"
|
||||||
#include "common/util.h"
|
#include "common/util.h"
|
||||||
|
#include "common/perf_timer.h"
|
||||||
#include "cryptonote_basic/cryptonote_format_utils.h"
|
#include "cryptonote_basic/cryptonote_format_utils.h"
|
||||||
#include "cryptonote_basic/account.h"
|
#include "cryptonote_basic/account.h"
|
||||||
#include "cryptonote_basic/cryptonote_basic_impl.h"
|
#include "cryptonote_basic/cryptonote_basic_impl.h"
|
||||||
@ -128,6 +129,7 @@ namespace cryptonote
|
|||||||
//------------------------------------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------------------------------------
|
||||||
bool core_rpc_server::on_get_height(const COMMAND_RPC_GET_HEIGHT::request& req, COMMAND_RPC_GET_HEIGHT::response& res)
|
bool core_rpc_server::on_get_height(const COMMAND_RPC_GET_HEIGHT::request& req, COMMAND_RPC_GET_HEIGHT::response& res)
|
||||||
{
|
{
|
||||||
|
PERF_TIMER(on_get_height);
|
||||||
CHECK_CORE_BUSY();
|
CHECK_CORE_BUSY();
|
||||||
res.height = m_core.get_current_blockchain_height();
|
res.height = m_core.get_current_blockchain_height();
|
||||||
res.status = CORE_RPC_STATUS_OK;
|
res.status = CORE_RPC_STATUS_OK;
|
||||||
@ -136,6 +138,7 @@ namespace cryptonote
|
|||||||
//------------------------------------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------------------------------------
|
||||||
bool core_rpc_server::on_get_info(const COMMAND_RPC_GET_INFO::request& req, COMMAND_RPC_GET_INFO::response& res)
|
bool core_rpc_server::on_get_info(const COMMAND_RPC_GET_INFO::request& req, COMMAND_RPC_GET_INFO::response& res)
|
||||||
{
|
{
|
||||||
|
PERF_TIMER(on_get_info);
|
||||||
CHECK_CORE_BUSY();
|
CHECK_CORE_BUSY();
|
||||||
crypto::hash top_hash;
|
crypto::hash top_hash;
|
||||||
m_core.get_blockchain_top(res.height, top_hash);
|
m_core.get_blockchain_top(res.height, top_hash);
|
||||||
@ -179,6 +182,7 @@ namespace cryptonote
|
|||||||
//------------------------------------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------------------------------------
|
||||||
bool core_rpc_server::on_get_blocks(const COMMAND_RPC_GET_BLOCKS_FAST::request& req, COMMAND_RPC_GET_BLOCKS_FAST::response& res)
|
bool core_rpc_server::on_get_blocks(const COMMAND_RPC_GET_BLOCKS_FAST::request& req, COMMAND_RPC_GET_BLOCKS_FAST::response& res)
|
||||||
{
|
{
|
||||||
|
PERF_TIMER(on_get_blocks);
|
||||||
CHECK_CORE_BUSY();
|
CHECK_CORE_BUSY();
|
||||||
std::list<std::pair<cryptonote::blobdata, std::list<cryptonote::blobdata> > > bs;
|
std::list<std::pair<cryptonote::blobdata, std::list<cryptonote::blobdata> > > bs;
|
||||||
|
|
||||||
@ -238,6 +242,7 @@ namespace cryptonote
|
|||||||
}
|
}
|
||||||
bool core_rpc_server::on_get_alt_blocks_hashes(const COMMAND_RPC_GET_ALT_BLOCKS_HASHES::request& req, COMMAND_RPC_GET_ALT_BLOCKS_HASHES::response& res)
|
bool core_rpc_server::on_get_alt_blocks_hashes(const COMMAND_RPC_GET_ALT_BLOCKS_HASHES::request& req, COMMAND_RPC_GET_ALT_BLOCKS_HASHES::response& res)
|
||||||
{
|
{
|
||||||
|
PERF_TIMER(on_get_alt_blocks_hashes);
|
||||||
CHECK_CORE_BUSY();
|
CHECK_CORE_BUSY();
|
||||||
std::list<block> blks;
|
std::list<block> blks;
|
||||||
|
|
||||||
@ -261,6 +266,7 @@ namespace cryptonote
|
|||||||
//------------------------------------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------------------------------------
|
||||||
bool core_rpc_server::on_get_blocks_by_height(const COMMAND_RPC_GET_BLOCKS_BY_HEIGHT::request& req, COMMAND_RPC_GET_BLOCKS_BY_HEIGHT::response& res)
|
bool core_rpc_server::on_get_blocks_by_height(const COMMAND_RPC_GET_BLOCKS_BY_HEIGHT::request& req, COMMAND_RPC_GET_BLOCKS_BY_HEIGHT::response& res)
|
||||||
{
|
{
|
||||||
|
PERF_TIMER(on_get_blocks_by_height);
|
||||||
CHECK_CORE_BUSY();
|
CHECK_CORE_BUSY();
|
||||||
res.status = "Failed";
|
res.status = "Failed";
|
||||||
res.blocks.clear();
|
res.blocks.clear();
|
||||||
@ -291,6 +297,7 @@ namespace cryptonote
|
|||||||
//------------------------------------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------------------------------------
|
||||||
bool core_rpc_server::on_get_hashes(const COMMAND_RPC_GET_HASHES_FAST::request& req, COMMAND_RPC_GET_HASHES_FAST::response& res)
|
bool core_rpc_server::on_get_hashes(const COMMAND_RPC_GET_HASHES_FAST::request& req, COMMAND_RPC_GET_HASHES_FAST::response& res)
|
||||||
{
|
{
|
||||||
|
PERF_TIMER(on_get_hashes);
|
||||||
CHECK_CORE_BUSY();
|
CHECK_CORE_BUSY();
|
||||||
NOTIFY_RESPONSE_CHAIN_ENTRY::request resp;
|
NOTIFY_RESPONSE_CHAIN_ENTRY::request resp;
|
||||||
|
|
||||||
@ -310,6 +317,7 @@ namespace cryptonote
|
|||||||
//------------------------------------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------------------------------------
|
||||||
bool core_rpc_server::on_get_random_outs(const COMMAND_RPC_GET_RANDOM_OUTPUTS_FOR_AMOUNTS::request& req, COMMAND_RPC_GET_RANDOM_OUTPUTS_FOR_AMOUNTS::response& res)
|
bool core_rpc_server::on_get_random_outs(const COMMAND_RPC_GET_RANDOM_OUTPUTS_FOR_AMOUNTS::request& req, COMMAND_RPC_GET_RANDOM_OUTPUTS_FOR_AMOUNTS::response& res)
|
||||||
{
|
{
|
||||||
|
PERF_TIMER(on_get_random_outs);
|
||||||
CHECK_CORE_BUSY();
|
CHECK_CORE_BUSY();
|
||||||
res.status = "Failed";
|
res.status = "Failed";
|
||||||
|
|
||||||
@ -349,6 +357,7 @@ namespace cryptonote
|
|||||||
//------------------------------------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------------------------------------
|
||||||
bool core_rpc_server::on_get_outs_bin(const COMMAND_RPC_GET_OUTPUTS_BIN::request& req, COMMAND_RPC_GET_OUTPUTS_BIN::response& res)
|
bool core_rpc_server::on_get_outs_bin(const COMMAND_RPC_GET_OUTPUTS_BIN::request& req, COMMAND_RPC_GET_OUTPUTS_BIN::response& res)
|
||||||
{
|
{
|
||||||
|
PERF_TIMER(on_get_outs_bin);
|
||||||
CHECK_CORE_BUSY();
|
CHECK_CORE_BUSY();
|
||||||
res.status = "Failed";
|
res.status = "Failed";
|
||||||
|
|
||||||
@ -372,6 +381,7 @@ namespace cryptonote
|
|||||||
//------------------------------------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------------------------------------
|
||||||
bool core_rpc_server::on_get_outs(const COMMAND_RPC_GET_OUTPUTS::request& req, COMMAND_RPC_GET_OUTPUTS::response& res)
|
bool core_rpc_server::on_get_outs(const COMMAND_RPC_GET_OUTPUTS::request& req, COMMAND_RPC_GET_OUTPUTS::response& res)
|
||||||
{
|
{
|
||||||
|
PERF_TIMER(on_get_outs);
|
||||||
CHECK_CORE_BUSY();
|
CHECK_CORE_BUSY();
|
||||||
res.status = "Failed";
|
res.status = "Failed";
|
||||||
|
|
||||||
@ -410,6 +420,7 @@ namespace cryptonote
|
|||||||
//------------------------------------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------------------------------------
|
||||||
bool core_rpc_server::on_get_random_rct_outs(const COMMAND_RPC_GET_RANDOM_RCT_OUTPUTS::request& req, COMMAND_RPC_GET_RANDOM_RCT_OUTPUTS::response& res)
|
bool core_rpc_server::on_get_random_rct_outs(const COMMAND_RPC_GET_RANDOM_RCT_OUTPUTS::request& req, COMMAND_RPC_GET_RANDOM_RCT_OUTPUTS::response& res)
|
||||||
{
|
{
|
||||||
|
PERF_TIMER(on_get_random_rct_outs);
|
||||||
CHECK_CORE_BUSY();
|
CHECK_CORE_BUSY();
|
||||||
res.status = "Failed";
|
res.status = "Failed";
|
||||||
if(!m_core.get_random_rct_outs(req, res))
|
if(!m_core.get_random_rct_outs(req, res))
|
||||||
@ -434,6 +445,7 @@ namespace cryptonote
|
|||||||
//------------------------------------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------------------------------------
|
||||||
bool core_rpc_server::on_get_indexes(const COMMAND_RPC_GET_TX_GLOBAL_OUTPUTS_INDEXES::request& req, COMMAND_RPC_GET_TX_GLOBAL_OUTPUTS_INDEXES::response& res)
|
bool core_rpc_server::on_get_indexes(const COMMAND_RPC_GET_TX_GLOBAL_OUTPUTS_INDEXES::request& req, COMMAND_RPC_GET_TX_GLOBAL_OUTPUTS_INDEXES::response& res)
|
||||||
{
|
{
|
||||||
|
PERF_TIMER(on_get_indexes);
|
||||||
CHECK_CORE_BUSY();
|
CHECK_CORE_BUSY();
|
||||||
bool r = m_core.get_tx_outputs_gindexs(req.txid, res.o_indexes);
|
bool r = m_core.get_tx_outputs_gindexs(req.txid, res.o_indexes);
|
||||||
if(!r)
|
if(!r)
|
||||||
@ -448,6 +460,7 @@ namespace cryptonote
|
|||||||
//------------------------------------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------------------------------------
|
||||||
bool core_rpc_server::on_get_transactions(const COMMAND_RPC_GET_TRANSACTIONS::request& req, COMMAND_RPC_GET_TRANSACTIONS::response& res)
|
bool core_rpc_server::on_get_transactions(const COMMAND_RPC_GET_TRANSACTIONS::request& req, COMMAND_RPC_GET_TRANSACTIONS::response& res)
|
||||||
{
|
{
|
||||||
|
PERF_TIMER(on_get_transactions);
|
||||||
CHECK_CORE_BUSY();
|
CHECK_CORE_BUSY();
|
||||||
std::vector<crypto::hash> vh;
|
std::vector<crypto::hash> vh;
|
||||||
for(const auto& tx_hex_str: req.txs_hashes)
|
for(const auto& tx_hex_str: req.txs_hashes)
|
||||||
@ -566,6 +579,7 @@ namespace cryptonote
|
|||||||
//------------------------------------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------------------------------------
|
||||||
bool core_rpc_server::on_is_key_image_spent(const COMMAND_RPC_IS_KEY_IMAGE_SPENT::request& req, COMMAND_RPC_IS_KEY_IMAGE_SPENT::response& res)
|
bool core_rpc_server::on_is_key_image_spent(const COMMAND_RPC_IS_KEY_IMAGE_SPENT::request& req, COMMAND_RPC_IS_KEY_IMAGE_SPENT::response& res)
|
||||||
{
|
{
|
||||||
|
PERF_TIMER(on_is_key_image_spent);
|
||||||
CHECK_CORE_BUSY();
|
CHECK_CORE_BUSY();
|
||||||
std::vector<crypto::key_image> key_images;
|
std::vector<crypto::key_image> key_images;
|
||||||
for(const auto& ki_hex_str: req.key_images)
|
for(const auto& ki_hex_str: req.key_images)
|
||||||
@ -629,6 +643,7 @@ namespace cryptonote
|
|||||||
//------------------------------------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------------------------------------
|
||||||
bool core_rpc_server::on_send_raw_tx(const COMMAND_RPC_SEND_RAW_TX::request& req, COMMAND_RPC_SEND_RAW_TX::response& res)
|
bool core_rpc_server::on_send_raw_tx(const COMMAND_RPC_SEND_RAW_TX::request& req, COMMAND_RPC_SEND_RAW_TX::response& res)
|
||||||
{
|
{
|
||||||
|
PERF_TIMER(on_send_raw_tx);
|
||||||
CHECK_CORE_READY();
|
CHECK_CORE_READY();
|
||||||
|
|
||||||
std::string tx_blob;
|
std::string tx_blob;
|
||||||
@ -692,6 +707,7 @@ namespace cryptonote
|
|||||||
//------------------------------------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------------------------------------
|
||||||
bool core_rpc_server::on_start_mining(const COMMAND_RPC_START_MINING::request& req, COMMAND_RPC_START_MINING::response& res)
|
bool core_rpc_server::on_start_mining(const COMMAND_RPC_START_MINING::request& req, COMMAND_RPC_START_MINING::response& res)
|
||||||
{
|
{
|
||||||
|
PERF_TIMER(on_start_mining);
|
||||||
CHECK_CORE_READY();
|
CHECK_CORE_READY();
|
||||||
cryptonote::address_parse_info info;
|
cryptonote::address_parse_info info;
|
||||||
if(!get_account_address_from_str(info, m_testnet, req.miner_address))
|
if(!get_account_address_from_str(info, m_testnet, req.miner_address))
|
||||||
@ -739,6 +755,7 @@ namespace cryptonote
|
|||||||
//------------------------------------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------------------------------------
|
||||||
bool core_rpc_server::on_stop_mining(const COMMAND_RPC_STOP_MINING::request& req, COMMAND_RPC_STOP_MINING::response& res)
|
bool core_rpc_server::on_stop_mining(const COMMAND_RPC_STOP_MINING::request& req, COMMAND_RPC_STOP_MINING::response& res)
|
||||||
{
|
{
|
||||||
|
PERF_TIMER(on_stop_mining);
|
||||||
if(!m_core.get_miner().stop())
|
if(!m_core.get_miner().stop())
|
||||||
{
|
{
|
||||||
res.status = "Failed, mining not stopped";
|
res.status = "Failed, mining not stopped";
|
||||||
@ -751,6 +768,7 @@ namespace cryptonote
|
|||||||
//------------------------------------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------------------------------------
|
||||||
bool core_rpc_server::on_mining_status(const COMMAND_RPC_MINING_STATUS::request& req, COMMAND_RPC_MINING_STATUS::response& res)
|
bool core_rpc_server::on_mining_status(const COMMAND_RPC_MINING_STATUS::request& req, COMMAND_RPC_MINING_STATUS::response& res)
|
||||||
{
|
{
|
||||||
|
PERF_TIMER(on_mining_status);
|
||||||
CHECK_CORE_BUSY();
|
CHECK_CORE_BUSY();
|
||||||
|
|
||||||
const miner& lMiner = m_core.get_miner();
|
const miner& lMiner = m_core.get_miner();
|
||||||
@ -770,6 +788,7 @@ namespace cryptonote
|
|||||||
//------------------------------------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------------------------------------
|
||||||
bool core_rpc_server::on_save_bc(const COMMAND_RPC_SAVE_BC::request& req, COMMAND_RPC_SAVE_BC::response& res)
|
bool core_rpc_server::on_save_bc(const COMMAND_RPC_SAVE_BC::request& req, COMMAND_RPC_SAVE_BC::response& res)
|
||||||
{
|
{
|
||||||
|
PERF_TIMER(on_save_bc);
|
||||||
CHECK_CORE_BUSY();
|
CHECK_CORE_BUSY();
|
||||||
if( !m_core.get_blockchain_storage().store_blockchain() )
|
if( !m_core.get_blockchain_storage().store_blockchain() )
|
||||||
{
|
{
|
||||||
@ -782,6 +801,7 @@ namespace cryptonote
|
|||||||
//------------------------------------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------------------------------------
|
||||||
bool core_rpc_server::on_get_peer_list(const COMMAND_RPC_GET_PEER_LIST::request& req, COMMAND_RPC_GET_PEER_LIST::response& res)
|
bool core_rpc_server::on_get_peer_list(const COMMAND_RPC_GET_PEER_LIST::request& req, COMMAND_RPC_GET_PEER_LIST::response& res)
|
||||||
{
|
{
|
||||||
|
PERF_TIMER(on_get_peer_list);
|
||||||
std::list<nodetool::peerlist_entry> white_list;
|
std::list<nodetool::peerlist_entry> white_list;
|
||||||
std::list<nodetool::peerlist_entry> gray_list;
|
std::list<nodetool::peerlist_entry> gray_list;
|
||||||
m_p2p.get_peerlist_manager().get_peerlist_full(gray_list, white_list);
|
m_p2p.get_peerlist_manager().get_peerlist_full(gray_list, white_list);
|
||||||
@ -811,6 +831,7 @@ namespace cryptonote
|
|||||||
//------------------------------------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------------------------------------
|
||||||
bool core_rpc_server::on_set_log_hash_rate(const COMMAND_RPC_SET_LOG_HASH_RATE::request& req, COMMAND_RPC_SET_LOG_HASH_RATE::response& res)
|
bool core_rpc_server::on_set_log_hash_rate(const COMMAND_RPC_SET_LOG_HASH_RATE::request& req, COMMAND_RPC_SET_LOG_HASH_RATE::response& res)
|
||||||
{
|
{
|
||||||
|
PERF_TIMER(on_set_log_hash_rate);
|
||||||
if(m_core.get_miner().is_mining())
|
if(m_core.get_miner().is_mining())
|
||||||
{
|
{
|
||||||
m_core.get_miner().do_print_hashrate(req.visible);
|
m_core.get_miner().do_print_hashrate(req.visible);
|
||||||
@ -825,6 +846,7 @@ namespace cryptonote
|
|||||||
//------------------------------------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------------------------------------
|
||||||
bool core_rpc_server::on_set_log_level(const COMMAND_RPC_SET_LOG_LEVEL::request& req, COMMAND_RPC_SET_LOG_LEVEL::response& res)
|
bool core_rpc_server::on_set_log_level(const COMMAND_RPC_SET_LOG_LEVEL::request& req, COMMAND_RPC_SET_LOG_LEVEL::response& res)
|
||||||
{
|
{
|
||||||
|
PERF_TIMER(on_set_log_level);
|
||||||
if (req.level < 0 || req.level > 4)
|
if (req.level < 0 || req.level > 4)
|
||||||
{
|
{
|
||||||
res.status = "Error: log level not valid";
|
res.status = "Error: log level not valid";
|
||||||
@ -837,6 +859,7 @@ namespace cryptonote
|
|||||||
//------------------------------------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------------------------------------
|
||||||
bool core_rpc_server::on_set_log_categories(const COMMAND_RPC_SET_LOG_CATEGORIES::request& req, COMMAND_RPC_SET_LOG_CATEGORIES::response& res)
|
bool core_rpc_server::on_set_log_categories(const COMMAND_RPC_SET_LOG_CATEGORIES::request& req, COMMAND_RPC_SET_LOG_CATEGORIES::response& res)
|
||||||
{
|
{
|
||||||
|
PERF_TIMER(on_set_log_categories);
|
||||||
mlog_set_log(req.categories.c_str());
|
mlog_set_log(req.categories.c_str());
|
||||||
res.categories = mlog_get_categories();
|
res.categories = mlog_get_categories();
|
||||||
res.status = CORE_RPC_STATUS_OK;
|
res.status = CORE_RPC_STATUS_OK;
|
||||||
@ -845,6 +868,7 @@ namespace cryptonote
|
|||||||
//------------------------------------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------------------------------------
|
||||||
bool core_rpc_server::on_get_transaction_pool(const COMMAND_RPC_GET_TRANSACTION_POOL::request& req, COMMAND_RPC_GET_TRANSACTION_POOL::response& res)
|
bool core_rpc_server::on_get_transaction_pool(const COMMAND_RPC_GET_TRANSACTION_POOL::request& req, COMMAND_RPC_GET_TRANSACTION_POOL::response& res)
|
||||||
{
|
{
|
||||||
|
PERF_TIMER(on_get_transaction_pool);
|
||||||
CHECK_CORE_BUSY();
|
CHECK_CORE_BUSY();
|
||||||
m_core.get_pool_transactions_and_spent_keys_info(res.transactions, res.spent_key_images);
|
m_core.get_pool_transactions_and_spent_keys_info(res.transactions, res.spent_key_images);
|
||||||
res.status = CORE_RPC_STATUS_OK;
|
res.status = CORE_RPC_STATUS_OK;
|
||||||
@ -853,6 +877,7 @@ namespace cryptonote
|
|||||||
//------------------------------------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------------------------------------
|
||||||
bool core_rpc_server::on_get_transaction_pool_hashes(const COMMAND_RPC_GET_TRANSACTION_POOL_HASHES::request& req, COMMAND_RPC_GET_TRANSACTION_POOL_HASHES::response& res)
|
bool core_rpc_server::on_get_transaction_pool_hashes(const COMMAND_RPC_GET_TRANSACTION_POOL_HASHES::request& req, COMMAND_RPC_GET_TRANSACTION_POOL_HASHES::response& res)
|
||||||
{
|
{
|
||||||
|
PERF_TIMER(on_get_transaction_pool_hashes);
|
||||||
CHECK_CORE_BUSY();
|
CHECK_CORE_BUSY();
|
||||||
m_core.get_pool_transaction_hashes(res.tx_hashes);
|
m_core.get_pool_transaction_hashes(res.tx_hashes);
|
||||||
res.status = CORE_RPC_STATUS_OK;
|
res.status = CORE_RPC_STATUS_OK;
|
||||||
@ -861,6 +886,7 @@ namespace cryptonote
|
|||||||
//------------------------------------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------------------------------------
|
||||||
bool core_rpc_server::on_get_transaction_pool_stats(const COMMAND_RPC_GET_TRANSACTION_POOL_STATS::request& req, COMMAND_RPC_GET_TRANSACTION_POOL_STATS::response& res)
|
bool core_rpc_server::on_get_transaction_pool_stats(const COMMAND_RPC_GET_TRANSACTION_POOL_STATS::request& req, COMMAND_RPC_GET_TRANSACTION_POOL_STATS::response& res)
|
||||||
{
|
{
|
||||||
|
PERF_TIMER(on_get_transaction_pool_stats);
|
||||||
CHECK_CORE_BUSY();
|
CHECK_CORE_BUSY();
|
||||||
m_core.get_pool_transaction_stats(res.pool_stats);
|
m_core.get_pool_transaction_stats(res.pool_stats);
|
||||||
res.status = CORE_RPC_STATUS_OK;
|
res.status = CORE_RPC_STATUS_OK;
|
||||||
@ -869,6 +895,7 @@ namespace cryptonote
|
|||||||
//------------------------------------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------------------------------------
|
||||||
bool core_rpc_server::on_stop_daemon(const COMMAND_RPC_STOP_DAEMON::request& req, COMMAND_RPC_STOP_DAEMON::response& res)
|
bool core_rpc_server::on_stop_daemon(const COMMAND_RPC_STOP_DAEMON::request& req, COMMAND_RPC_STOP_DAEMON::response& res)
|
||||||
{
|
{
|
||||||
|
PERF_TIMER(on_stop_daemon);
|
||||||
// FIXME: replace back to original m_p2p.send_stop_signal() after
|
// FIXME: replace back to original m_p2p.send_stop_signal() after
|
||||||
// investigating why that isn't working quite right.
|
// investigating why that isn't working quite right.
|
||||||
m_p2p.send_stop_signal();
|
m_p2p.send_stop_signal();
|
||||||
@ -878,6 +905,7 @@ namespace cryptonote
|
|||||||
//------------------------------------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------------------------------------
|
||||||
bool core_rpc_server::on_getblockcount(const COMMAND_RPC_GETBLOCKCOUNT::request& req, COMMAND_RPC_GETBLOCKCOUNT::response& res)
|
bool core_rpc_server::on_getblockcount(const COMMAND_RPC_GETBLOCKCOUNT::request& req, COMMAND_RPC_GETBLOCKCOUNT::response& res)
|
||||||
{
|
{
|
||||||
|
PERF_TIMER(on_getblockcount);
|
||||||
CHECK_CORE_BUSY();
|
CHECK_CORE_BUSY();
|
||||||
res.count = m_core.get_current_blockchain_height();
|
res.count = m_core.get_current_blockchain_height();
|
||||||
res.status = CORE_RPC_STATUS_OK;
|
res.status = CORE_RPC_STATUS_OK;
|
||||||
@ -886,6 +914,7 @@ namespace cryptonote
|
|||||||
//------------------------------------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------------------------------------
|
||||||
bool core_rpc_server::on_getblockhash(const COMMAND_RPC_GETBLOCKHASH::request& req, COMMAND_RPC_GETBLOCKHASH::response& res, epee::json_rpc::error& error_resp)
|
bool core_rpc_server::on_getblockhash(const COMMAND_RPC_GETBLOCKHASH::request& req, COMMAND_RPC_GETBLOCKHASH::response& res, epee::json_rpc::error& error_resp)
|
||||||
{
|
{
|
||||||
|
PERF_TIMER(on_getblockhash);
|
||||||
if(!check_core_busy())
|
if(!check_core_busy())
|
||||||
{
|
{
|
||||||
error_resp.code = CORE_RPC_ERROR_CODE_CORE_BUSY;
|
error_resp.code = CORE_RPC_ERROR_CODE_CORE_BUSY;
|
||||||
@ -927,6 +956,7 @@ namespace cryptonote
|
|||||||
//------------------------------------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------------------------------------
|
||||||
bool core_rpc_server::on_getblocktemplate(const COMMAND_RPC_GETBLOCKTEMPLATE::request& req, COMMAND_RPC_GETBLOCKTEMPLATE::response& res, epee::json_rpc::error& error_resp)
|
bool core_rpc_server::on_getblocktemplate(const COMMAND_RPC_GETBLOCKTEMPLATE::request& req, COMMAND_RPC_GETBLOCKTEMPLATE::response& res, epee::json_rpc::error& error_resp)
|
||||||
{
|
{
|
||||||
|
PERF_TIMER(on_getblocktemplate);
|
||||||
if(!check_core_ready())
|
if(!check_core_ready())
|
||||||
{
|
{
|
||||||
error_resp.code = CORE_RPC_ERROR_CODE_CORE_BUSY;
|
error_resp.code = CORE_RPC_ERROR_CODE_CORE_BUSY;
|
||||||
@ -1001,6 +1031,7 @@ namespace cryptonote
|
|||||||
//------------------------------------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------------------------------------
|
||||||
bool core_rpc_server::on_submitblock(const COMMAND_RPC_SUBMITBLOCK::request& req, COMMAND_RPC_SUBMITBLOCK::response& res, epee::json_rpc::error& error_resp)
|
bool core_rpc_server::on_submitblock(const COMMAND_RPC_SUBMITBLOCK::request& req, COMMAND_RPC_SUBMITBLOCK::response& res, epee::json_rpc::error& error_resp)
|
||||||
{
|
{
|
||||||
|
PERF_TIMER(on_submitblock);
|
||||||
CHECK_CORE_READY();
|
CHECK_CORE_READY();
|
||||||
if(req.size()!=1)
|
if(req.size()!=1)
|
||||||
{
|
{
|
||||||
@ -1057,6 +1088,7 @@ namespace cryptonote
|
|||||||
//------------------------------------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------------------------------------
|
||||||
bool core_rpc_server::fill_block_header_response(const block& blk, bool orphan_status, uint64_t height, const crypto::hash& hash, block_header_response& response)
|
bool core_rpc_server::fill_block_header_response(const block& blk, bool orphan_status, uint64_t height, const crypto::hash& hash, block_header_response& response)
|
||||||
{
|
{
|
||||||
|
PERF_TIMER(fill_block_header_response);
|
||||||
response.major_version = blk.major_version;
|
response.major_version = blk.major_version;
|
||||||
response.minor_version = blk.minor_version;
|
response.minor_version = blk.minor_version;
|
||||||
response.timestamp = blk.timestamp;
|
response.timestamp = blk.timestamp;
|
||||||
@ -1075,6 +1107,7 @@ namespace cryptonote
|
|||||||
//------------------------------------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------------------------------------
|
||||||
bool core_rpc_server::on_get_last_block_header(const COMMAND_RPC_GET_LAST_BLOCK_HEADER::request& req, COMMAND_RPC_GET_LAST_BLOCK_HEADER::response& res, epee::json_rpc::error& error_resp)
|
bool core_rpc_server::on_get_last_block_header(const COMMAND_RPC_GET_LAST_BLOCK_HEADER::request& req, COMMAND_RPC_GET_LAST_BLOCK_HEADER::response& res, epee::json_rpc::error& error_resp)
|
||||||
{
|
{
|
||||||
|
PERF_TIMER(on_get_last_block_header);
|
||||||
if(!check_core_busy())
|
if(!check_core_busy())
|
||||||
{
|
{
|
||||||
error_resp.code = CORE_RPC_ERROR_CODE_CORE_BUSY;
|
error_resp.code = CORE_RPC_ERROR_CODE_CORE_BUSY;
|
||||||
@ -1104,6 +1137,7 @@ namespace cryptonote
|
|||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------------------------------------
|
||||||
bool core_rpc_server::on_get_block_header_by_hash(const COMMAND_RPC_GET_BLOCK_HEADER_BY_HASH::request& req, COMMAND_RPC_GET_BLOCK_HEADER_BY_HASH::response& res, epee::json_rpc::error& error_resp){
|
bool core_rpc_server::on_get_block_header_by_hash(const COMMAND_RPC_GET_BLOCK_HEADER_BY_HASH::request& req, COMMAND_RPC_GET_BLOCK_HEADER_BY_HASH::response& res, epee::json_rpc::error& error_resp){
|
||||||
|
PERF_TIMER(on_get_block_header_by_hash);
|
||||||
if(!check_core_busy())
|
if(!check_core_busy())
|
||||||
{
|
{
|
||||||
error_resp.code = CORE_RPC_ERROR_CODE_CORE_BUSY;
|
error_resp.code = CORE_RPC_ERROR_CODE_CORE_BUSY;
|
||||||
@ -1146,6 +1180,7 @@ namespace cryptonote
|
|||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------------------------------------
|
||||||
bool core_rpc_server::on_get_block_headers_range(const COMMAND_RPC_GET_BLOCK_HEADERS_RANGE::request& req, COMMAND_RPC_GET_BLOCK_HEADERS_RANGE::response& res, epee::json_rpc::error& error_resp){
|
bool core_rpc_server::on_get_block_headers_range(const COMMAND_RPC_GET_BLOCK_HEADERS_RANGE::request& req, COMMAND_RPC_GET_BLOCK_HEADERS_RANGE::response& res, epee::json_rpc::error& error_resp){
|
||||||
|
PERF_TIMER(on_get_block_headers_range);
|
||||||
if(!check_core_busy())
|
if(!check_core_busy())
|
||||||
{
|
{
|
||||||
error_resp.code = CORE_RPC_ERROR_CODE_CORE_BUSY;
|
error_resp.code = CORE_RPC_ERROR_CODE_CORE_BUSY;
|
||||||
@ -1197,6 +1232,7 @@ namespace cryptonote
|
|||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------------------------------------
|
||||||
bool core_rpc_server::on_get_block_header_by_height(const COMMAND_RPC_GET_BLOCK_HEADER_BY_HEIGHT::request& req, COMMAND_RPC_GET_BLOCK_HEADER_BY_HEIGHT::response& res, epee::json_rpc::error& error_resp){
|
bool core_rpc_server::on_get_block_header_by_height(const COMMAND_RPC_GET_BLOCK_HEADER_BY_HEIGHT::request& req, COMMAND_RPC_GET_BLOCK_HEADER_BY_HEIGHT::response& res, epee::json_rpc::error& error_resp){
|
||||||
|
PERF_TIMER(on_get_block_header_by_height);
|
||||||
if(!check_core_busy())
|
if(!check_core_busy())
|
||||||
{
|
{
|
||||||
error_resp.code = CORE_RPC_ERROR_CODE_CORE_BUSY;
|
error_resp.code = CORE_RPC_ERROR_CODE_CORE_BUSY;
|
||||||
@ -1230,6 +1266,7 @@ namespace cryptonote
|
|||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------------------------------------
|
||||||
bool core_rpc_server::on_get_block(const COMMAND_RPC_GET_BLOCK::request& req, COMMAND_RPC_GET_BLOCK::response& res, epee::json_rpc::error& error_resp){
|
bool core_rpc_server::on_get_block(const COMMAND_RPC_GET_BLOCK::request& req, COMMAND_RPC_GET_BLOCK::response& res, epee::json_rpc::error& error_resp){
|
||||||
|
PERF_TIMER(on_get_block);
|
||||||
if(!check_core_busy())
|
if(!check_core_busy())
|
||||||
{
|
{
|
||||||
error_resp.code = CORE_RPC_ERROR_CODE_CORE_BUSY;
|
error_resp.code = CORE_RPC_ERROR_CODE_CORE_BUSY;
|
||||||
@ -1292,6 +1329,7 @@ namespace cryptonote
|
|||||||
//------------------------------------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------------------------------------
|
||||||
bool core_rpc_server::on_get_connections(const COMMAND_RPC_GET_CONNECTIONS::request& req, COMMAND_RPC_GET_CONNECTIONS::response& res, epee::json_rpc::error& error_resp)
|
bool core_rpc_server::on_get_connections(const COMMAND_RPC_GET_CONNECTIONS::request& req, COMMAND_RPC_GET_CONNECTIONS::response& res, epee::json_rpc::error& error_resp)
|
||||||
{
|
{
|
||||||
|
PERF_TIMER(on_get_connections);
|
||||||
if(!check_core_busy())
|
if(!check_core_busy())
|
||||||
{
|
{
|
||||||
error_resp.code = CORE_RPC_ERROR_CODE_CORE_BUSY;
|
error_resp.code = CORE_RPC_ERROR_CODE_CORE_BUSY;
|
||||||
@ -1308,6 +1346,7 @@ namespace cryptonote
|
|||||||
//------------------------------------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------------------------------------
|
||||||
bool core_rpc_server::on_get_info_json(const COMMAND_RPC_GET_INFO::request& req, COMMAND_RPC_GET_INFO::response& res, epee::json_rpc::error& error_resp)
|
bool core_rpc_server::on_get_info_json(const COMMAND_RPC_GET_INFO::request& req, COMMAND_RPC_GET_INFO::response& res, epee::json_rpc::error& error_resp)
|
||||||
{
|
{
|
||||||
|
PERF_TIMER(on_get_info_json);
|
||||||
if(!check_core_busy())
|
if(!check_core_busy())
|
||||||
{
|
{
|
||||||
error_resp.code = CORE_RPC_ERROR_CODE_CORE_BUSY;
|
error_resp.code = CORE_RPC_ERROR_CODE_CORE_BUSY;
|
||||||
@ -1340,6 +1379,7 @@ namespace cryptonote
|
|||||||
//------------------------------------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------------------------------------
|
||||||
bool core_rpc_server::on_hard_fork_info(const COMMAND_RPC_HARD_FORK_INFO::request& req, COMMAND_RPC_HARD_FORK_INFO::response& res, epee::json_rpc::error& error_resp)
|
bool core_rpc_server::on_hard_fork_info(const COMMAND_RPC_HARD_FORK_INFO::request& req, COMMAND_RPC_HARD_FORK_INFO::response& res, epee::json_rpc::error& error_resp)
|
||||||
{
|
{
|
||||||
|
PERF_TIMER(on_hard_fork_info);
|
||||||
if(!check_core_busy())
|
if(!check_core_busy())
|
||||||
{
|
{
|
||||||
error_resp.code = CORE_RPC_ERROR_CODE_CORE_BUSY;
|
error_resp.code = CORE_RPC_ERROR_CODE_CORE_BUSY;
|
||||||
@ -1358,6 +1398,7 @@ namespace cryptonote
|
|||||||
//------------------------------------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------------------------------------
|
||||||
bool core_rpc_server::on_get_bans(const COMMAND_RPC_GETBANS::request& req, COMMAND_RPC_GETBANS::response& res, epee::json_rpc::error& error_resp)
|
bool core_rpc_server::on_get_bans(const COMMAND_RPC_GETBANS::request& req, COMMAND_RPC_GETBANS::response& res, epee::json_rpc::error& error_resp)
|
||||||
{
|
{
|
||||||
|
PERF_TIMER(on_get_bans);
|
||||||
if(!check_core_busy())
|
if(!check_core_busy())
|
||||||
{
|
{
|
||||||
error_resp.code = CORE_RPC_ERROR_CODE_CORE_BUSY;
|
error_resp.code = CORE_RPC_ERROR_CODE_CORE_BUSY;
|
||||||
@ -1387,6 +1428,7 @@ namespace cryptonote
|
|||||||
//------------------------------------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------------------------------------
|
||||||
bool core_rpc_server::on_set_bans(const COMMAND_RPC_SETBANS::request& req, COMMAND_RPC_SETBANS::response& res, epee::json_rpc::error& error_resp)
|
bool core_rpc_server::on_set_bans(const COMMAND_RPC_SETBANS::request& req, COMMAND_RPC_SETBANS::response& res, epee::json_rpc::error& error_resp)
|
||||||
{
|
{
|
||||||
|
PERF_TIMER(on_set_bans);
|
||||||
if(!check_core_busy())
|
if(!check_core_busy())
|
||||||
{
|
{
|
||||||
error_resp.code = CORE_RPC_ERROR_CODE_CORE_BUSY;
|
error_resp.code = CORE_RPC_ERROR_CODE_CORE_BUSY;
|
||||||
@ -1422,6 +1464,7 @@ namespace cryptonote
|
|||||||
//------------------------------------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------------------------------------
|
||||||
bool core_rpc_server::on_flush_txpool(const COMMAND_RPC_FLUSH_TRANSACTION_POOL::request& req, COMMAND_RPC_FLUSH_TRANSACTION_POOL::response& res, epee::json_rpc::error& error_resp)
|
bool core_rpc_server::on_flush_txpool(const COMMAND_RPC_FLUSH_TRANSACTION_POOL::request& req, COMMAND_RPC_FLUSH_TRANSACTION_POOL::response& res, epee::json_rpc::error& error_resp)
|
||||||
{
|
{
|
||||||
|
PERF_TIMER(on_flush_txpool);
|
||||||
if(!check_core_busy())
|
if(!check_core_busy())
|
||||||
{
|
{
|
||||||
error_resp.code = CORE_RPC_ERROR_CODE_CORE_BUSY;
|
error_resp.code = CORE_RPC_ERROR_CODE_CORE_BUSY;
|
||||||
@ -1476,6 +1519,7 @@ namespace cryptonote
|
|||||||
//------------------------------------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------------------------------------
|
||||||
bool core_rpc_server::on_get_output_histogram(const COMMAND_RPC_GET_OUTPUT_HISTOGRAM::request& req, COMMAND_RPC_GET_OUTPUT_HISTOGRAM::response& res, epee::json_rpc::error& error_resp)
|
bool core_rpc_server::on_get_output_histogram(const COMMAND_RPC_GET_OUTPUT_HISTOGRAM::request& req, COMMAND_RPC_GET_OUTPUT_HISTOGRAM::response& res, epee::json_rpc::error& error_resp)
|
||||||
{
|
{
|
||||||
|
PERF_TIMER(on_get_output_histogram);
|
||||||
if(!check_core_busy())
|
if(!check_core_busy())
|
||||||
{
|
{
|
||||||
error_resp.code = CORE_RPC_ERROR_CODE_CORE_BUSY;
|
error_resp.code = CORE_RPC_ERROR_CODE_CORE_BUSY;
|
||||||
@ -1508,6 +1552,7 @@ namespace cryptonote
|
|||||||
//------------------------------------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------------------------------------
|
||||||
bool core_rpc_server::on_get_version(const COMMAND_RPC_GET_VERSION::request& req, COMMAND_RPC_GET_VERSION::response& res, epee::json_rpc::error& error_resp)
|
bool core_rpc_server::on_get_version(const COMMAND_RPC_GET_VERSION::request& req, COMMAND_RPC_GET_VERSION::response& res, epee::json_rpc::error& error_resp)
|
||||||
{
|
{
|
||||||
|
PERF_TIMER(on_get_version);
|
||||||
res.version = CORE_RPC_VERSION;
|
res.version = CORE_RPC_VERSION;
|
||||||
res.status = CORE_RPC_STATUS_OK;
|
res.status = CORE_RPC_STATUS_OK;
|
||||||
return true;
|
return true;
|
||||||
@ -1515,6 +1560,7 @@ namespace cryptonote
|
|||||||
//------------------------------------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------------------------------------
|
||||||
bool core_rpc_server::on_get_coinbase_tx_sum(const COMMAND_RPC_GET_COINBASE_TX_SUM::request& req, COMMAND_RPC_GET_COINBASE_TX_SUM::response& res, epee::json_rpc::error& error_resp)
|
bool core_rpc_server::on_get_coinbase_tx_sum(const COMMAND_RPC_GET_COINBASE_TX_SUM::request& req, COMMAND_RPC_GET_COINBASE_TX_SUM::response& res, epee::json_rpc::error& error_resp)
|
||||||
{
|
{
|
||||||
|
PERF_TIMER(on_get_coinbase_tx_sum);
|
||||||
std::pair<uint64_t, uint64_t> amounts = m_core.get_coinbase_tx_sum(req.height, req.count);
|
std::pair<uint64_t, uint64_t> amounts = m_core.get_coinbase_tx_sum(req.height, req.count);
|
||||||
res.emission_amount = amounts.first;
|
res.emission_amount = amounts.first;
|
||||||
res.fee_amount = amounts.second;
|
res.fee_amount = amounts.second;
|
||||||
@ -1524,6 +1570,7 @@ namespace cryptonote
|
|||||||
//------------------------------------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------------------------------------
|
||||||
bool core_rpc_server::on_get_per_kb_fee_estimate(const COMMAND_RPC_GET_PER_KB_FEE_ESTIMATE::request& req, COMMAND_RPC_GET_PER_KB_FEE_ESTIMATE::response& res, epee::json_rpc::error& error_resp)
|
bool core_rpc_server::on_get_per_kb_fee_estimate(const COMMAND_RPC_GET_PER_KB_FEE_ESTIMATE::request& req, COMMAND_RPC_GET_PER_KB_FEE_ESTIMATE::response& res, epee::json_rpc::error& error_resp)
|
||||||
{
|
{
|
||||||
|
PERF_TIMER(on_get_per_kb_fee_estimate);
|
||||||
res.fee = m_core.get_blockchain_storage().get_dynamic_per_kb_fee_estimate(req.grace_blocks);
|
res.fee = m_core.get_blockchain_storage().get_dynamic_per_kb_fee_estimate(req.grace_blocks);
|
||||||
res.status = CORE_RPC_STATUS_OK;
|
res.status = CORE_RPC_STATUS_OK;
|
||||||
return true;
|
return true;
|
||||||
@ -1531,6 +1578,7 @@ namespace cryptonote
|
|||||||
//------------------------------------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------------------------------------
|
||||||
bool core_rpc_server::on_get_alternate_chains(const COMMAND_RPC_GET_ALTERNATE_CHAINS::request& req, COMMAND_RPC_GET_ALTERNATE_CHAINS::response& res, epee::json_rpc::error& error_resp)
|
bool core_rpc_server::on_get_alternate_chains(const COMMAND_RPC_GET_ALTERNATE_CHAINS::request& req, COMMAND_RPC_GET_ALTERNATE_CHAINS::response& res, epee::json_rpc::error& error_resp)
|
||||||
{
|
{
|
||||||
|
PERF_TIMER(on_get_alternate_chains);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
std::list<std::pair<Blockchain::block_extended_info, uint64_t>> chains = m_core.get_blockchain_storage().get_alternative_chains();
|
std::list<std::pair<Blockchain::block_extended_info, uint64_t>> chains = m_core.get_blockchain_storage().get_alternative_chains();
|
||||||
@ -1549,6 +1597,7 @@ namespace cryptonote
|
|||||||
//------------------------------------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------------------------------------
|
||||||
bool core_rpc_server::on_get_limit(const COMMAND_RPC_GET_LIMIT::request& req, COMMAND_RPC_GET_LIMIT::response& res)
|
bool core_rpc_server::on_get_limit(const COMMAND_RPC_GET_LIMIT::request& req, COMMAND_RPC_GET_LIMIT::response& res)
|
||||||
{
|
{
|
||||||
|
PERF_TIMER(on_get_limit);
|
||||||
res.limit_down = epee::net_utils::connection_basic::get_rate_down_limit();
|
res.limit_down = epee::net_utils::connection_basic::get_rate_down_limit();
|
||||||
res.limit_up = epee::net_utils::connection_basic::get_rate_up_limit();
|
res.limit_up = epee::net_utils::connection_basic::get_rate_up_limit();
|
||||||
res.status = CORE_RPC_STATUS_OK;
|
res.status = CORE_RPC_STATUS_OK;
|
||||||
@ -1557,6 +1606,7 @@ namespace cryptonote
|
|||||||
//------------------------------------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------------------------------------
|
||||||
bool core_rpc_server::on_set_limit(const COMMAND_RPC_SET_LIMIT::request& req, COMMAND_RPC_SET_LIMIT::response& res)
|
bool core_rpc_server::on_set_limit(const COMMAND_RPC_SET_LIMIT::request& req, COMMAND_RPC_SET_LIMIT::response& res)
|
||||||
{
|
{
|
||||||
|
PERF_TIMER(on_set_limit);
|
||||||
// -1 = reset to default
|
// -1 = reset to default
|
||||||
// 0 = do not modify
|
// 0 = do not modify
|
||||||
|
|
||||||
@ -1596,6 +1646,7 @@ namespace cryptonote
|
|||||||
//------------------------------------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------------------------------------
|
||||||
bool core_rpc_server::on_out_peers(const COMMAND_RPC_OUT_PEERS::request& req, COMMAND_RPC_OUT_PEERS::response& res)
|
bool core_rpc_server::on_out_peers(const COMMAND_RPC_OUT_PEERS::request& req, COMMAND_RPC_OUT_PEERS::response& res)
|
||||||
{
|
{
|
||||||
|
PERF_TIMER(on_out_peers);
|
||||||
size_t n_connections = m_p2p.get_outgoing_connections_count();
|
size_t n_connections = m_p2p.get_outgoing_connections_count();
|
||||||
size_t n_delete = (n_connections > req.out_peers) ? n_connections - req.out_peers : 0;
|
size_t n_delete = (n_connections > req.out_peers) ? n_connections - req.out_peers : 0;
|
||||||
m_p2p.m_config.m_net_config.connections_count = req.out_peers;
|
m_p2p.m_config.m_net_config.connections_count = req.out_peers;
|
||||||
@ -1607,6 +1658,7 @@ namespace cryptonote
|
|||||||
//------------------------------------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------------------------------------
|
||||||
bool core_rpc_server::on_start_save_graph(const COMMAND_RPC_START_SAVE_GRAPH::request& req, COMMAND_RPC_START_SAVE_GRAPH::response& res)
|
bool core_rpc_server::on_start_save_graph(const COMMAND_RPC_START_SAVE_GRAPH::request& req, COMMAND_RPC_START_SAVE_GRAPH::response& res)
|
||||||
{
|
{
|
||||||
|
PERF_TIMER(on_start_save_graph);
|
||||||
m_p2p.set_save_graph(true);
|
m_p2p.set_save_graph(true);
|
||||||
res.status = CORE_RPC_STATUS_OK;
|
res.status = CORE_RPC_STATUS_OK;
|
||||||
return true;
|
return true;
|
||||||
@ -1614,6 +1666,7 @@ namespace cryptonote
|
|||||||
//------------------------------------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------------------------------------
|
||||||
bool core_rpc_server::on_stop_save_graph(const COMMAND_RPC_STOP_SAVE_GRAPH::request& req, COMMAND_RPC_STOP_SAVE_GRAPH::response& res)
|
bool core_rpc_server::on_stop_save_graph(const COMMAND_RPC_STOP_SAVE_GRAPH::request& req, COMMAND_RPC_STOP_SAVE_GRAPH::response& res)
|
||||||
{
|
{
|
||||||
|
PERF_TIMER(on_stop_save_graph);
|
||||||
m_p2p.set_save_graph(false);
|
m_p2p.set_save_graph(false);
|
||||||
res.status = CORE_RPC_STATUS_OK;
|
res.status = CORE_RPC_STATUS_OK;
|
||||||
return true;
|
return true;
|
||||||
@ -1621,6 +1674,7 @@ namespace cryptonote
|
|||||||
//------------------------------------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------------------------------------
|
||||||
bool core_rpc_server::on_update(const COMMAND_RPC_UPDATE::request& req, COMMAND_RPC_UPDATE::response& res)
|
bool core_rpc_server::on_update(const COMMAND_RPC_UPDATE::request& req, COMMAND_RPC_UPDATE::response& res)
|
||||||
{
|
{
|
||||||
|
PERF_TIMER(on_update);
|
||||||
static const char software[] = "monero";
|
static const char software[] = "monero";
|
||||||
#ifdef BUILD_TAG
|
#ifdef BUILD_TAG
|
||||||
static const char buildtag[] = BOOST_PP_STRINGIZE(BUILD_TAG);
|
static const char buildtag[] = BOOST_PP_STRINGIZE(BUILD_TAG);
|
||||||
@ -1715,6 +1769,7 @@ namespace cryptonote
|
|||||||
//------------------------------------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------------------------------------
|
||||||
bool core_rpc_server::on_relay_tx(const COMMAND_RPC_RELAY_TX::request& req, COMMAND_RPC_RELAY_TX::response& res, epee::json_rpc::error& error_resp)
|
bool core_rpc_server::on_relay_tx(const COMMAND_RPC_RELAY_TX::request& req, COMMAND_RPC_RELAY_TX::response& res, epee::json_rpc::error& error_resp)
|
||||||
{
|
{
|
||||||
|
PERF_TIMER(on_relay_tx);
|
||||||
if(!check_core_busy())
|
if(!check_core_busy())
|
||||||
{
|
{
|
||||||
error_resp.code = CORE_RPC_ERROR_CODE_CORE_BUSY;
|
error_resp.code = CORE_RPC_ERROR_CODE_CORE_BUSY;
|
||||||
@ -1761,6 +1816,7 @@ namespace cryptonote
|
|||||||
//------------------------------------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------------------------------------
|
||||||
bool core_rpc_server::on_sync_info(const COMMAND_RPC_SYNC_INFO::request& req, COMMAND_RPC_SYNC_INFO::response& res, epee::json_rpc::error& error_resp)
|
bool core_rpc_server::on_sync_info(const COMMAND_RPC_SYNC_INFO::request& req, COMMAND_RPC_SYNC_INFO::response& res, epee::json_rpc::error& error_resp)
|
||||||
{
|
{
|
||||||
|
PERF_TIMER(on_sync_info);
|
||||||
if(!check_core_busy())
|
if(!check_core_busy())
|
||||||
{
|
{
|
||||||
error_resp.code = CORE_RPC_ERROR_CODE_CORE_BUSY;
|
error_resp.code = CORE_RPC_ERROR_CODE_CORE_BUSY;
|
||||||
@ -1792,6 +1848,7 @@ namespace cryptonote
|
|||||||
//------------------------------------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------------------------------------
|
||||||
bool core_rpc_server::on_get_txpool_backlog(const COMMAND_RPC_GET_TRANSACTION_POOL_BACKLOG::request& req, COMMAND_RPC_GET_TRANSACTION_POOL_BACKLOG::response& res, epee::json_rpc::error& error_resp)
|
bool core_rpc_server::on_get_txpool_backlog(const COMMAND_RPC_GET_TRANSACTION_POOL_BACKLOG::request& req, COMMAND_RPC_GET_TRANSACTION_POOL_BACKLOG::response& res, epee::json_rpc::error& error_resp)
|
||||||
{
|
{
|
||||||
|
PERF_TIMER(on_get_txpool_backlog);
|
||||||
if(!check_core_busy())
|
if(!check_core_busy())
|
||||||
{
|
{
|
||||||
error_resp.code = CORE_RPC_ERROR_CODE_CORE_BUSY;
|
error_resp.code = CORE_RPC_ERROR_CODE_CORE_BUSY;
|
||||||
|
Loading…
Reference in New Issue
Block a user