|
|
|
@ -928,13 +928,12 @@ namespace cryptonote
|
|
|
|
|
template<class t_core>
|
|
|
|
|
int t_cryptonote_protocol_handler<t_core>::handle_request_get_objects(int command, NOTIFY_REQUEST_GET_OBJECTS::request& arg, cryptonote_connection_context& context)
|
|
|
|
|
{
|
|
|
|
|
MLOG_P2P_MESSAGE("Received NOTIFY_REQUEST_GET_OBJECTS (" << arg.blocks.size() << " blocks, " << arg.txs.size() << " txes)");
|
|
|
|
|
|
|
|
|
|
if (arg.blocks.size() + arg.txs.size() > CURRENCY_PROTOCOL_MAX_OBJECT_REQUEST_COUNT)
|
|
|
|
|
MLOG_P2P_MESSAGE("Received NOTIFY_REQUEST_GET_OBJECTS (" << arg.blocks.size() << " blocks)");
|
|
|
|
|
if (arg.blocks.size() > CURRENCY_PROTOCOL_MAX_OBJECT_REQUEST_COUNT)
|
|
|
|
|
{
|
|
|
|
|
LOG_ERROR_CCONTEXT(
|
|
|
|
|
"Requested objects count is too big ("
|
|
|
|
|
<< arg.blocks.size() + arg.txs.size() << ") expected not more then "
|
|
|
|
|
<< arg.blocks.size() << ") expected not more then "
|
|
|
|
|
<< CURRENCY_PROTOCOL_MAX_OBJECT_REQUEST_COUNT);
|
|
|
|
|
drop_connection(context, false, false);
|
|
|
|
|
return 1;
|
|
|
|
@ -947,8 +946,9 @@ namespace cryptonote
|
|
|
|
|
drop_connection(context, false, false);
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
MLOG_P2P_MESSAGE("-->>NOTIFY_RESPONSE_GET_OBJECTS: blocks.size()=" << rsp.blocks.size() << ", txs.size()=" << rsp.txs.size()
|
|
|
|
|
<< ", rsp.m_current_blockchain_height=" << rsp.current_blockchain_height << ", missed_ids.size()=" << rsp.missed_ids.size());
|
|
|
|
|
MLOG_P2P_MESSAGE("-->>NOTIFY_RESPONSE_GET_OBJECTS: blocks.size()="
|
|
|
|
|
<< rsp.blocks.size() << ", rsp.m_current_blockchain_height=" << rsp.current_blockchain_height
|
|
|
|
|
<< ", missed_ids.size()=" << rsp.missed_ids.size());
|
|
|
|
|
post_notify<NOTIFY_RESPONSE_GET_OBJECTS>(rsp, context);
|
|
|
|
|
//handler_response_blocks_now(sizeof(rsp)); // XXX
|
|
|
|
|
//handler_response_blocks_now(200);
|
|
|
|
@ -973,7 +973,7 @@ namespace cryptonote
|
|
|
|
|
template<class t_core>
|
|
|
|
|
int t_cryptonote_protocol_handler<t_core>::handle_response_get_objects(int command, NOTIFY_RESPONSE_GET_OBJECTS::request& arg, cryptonote_connection_context& context)
|
|
|
|
|
{
|
|
|
|
|
MLOG_P2P_MESSAGE("Received NOTIFY_RESPONSE_GET_OBJECTS (" << arg.blocks.size() << " blocks, " << arg.txs.size() << " txes)");
|
|
|
|
|
MLOG_P2P_MESSAGE("Received NOTIFY_RESPONSE_GET_OBJECTS (" << arg.blocks.size() << " blocks)");
|
|
|
|
|
MLOG_PEER_STATE("received objects");
|
|
|
|
|
|
|
|
|
|
boost::posix_time::ptime request_time = context.m_last_request_time;
|
|
|
|
@ -981,8 +981,6 @@ namespace cryptonote
|
|
|
|
|
|
|
|
|
|
// calculate size of request
|
|
|
|
|
size_t size = 0;
|
|
|
|
|
for (const auto &element : arg.txs) size += element.size();
|
|
|
|
|
|
|
|
|
|
size_t blocks_size = 0;
|
|
|
|
|
for (const auto &element : arg.blocks) {
|
|
|
|
|
blocks_size += element.block.size();
|
|
|
|
@ -1942,7 +1940,7 @@ skip:
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
context.m_last_request_time = boost::posix_time::microsec_clock::universal_time();
|
|
|
|
|
MLOG_P2P_MESSAGE("-->>NOTIFY_REQUEST_GET_OBJECTS: blocks.size()=" << req.blocks.size() << ", txs.size()=" << req.txs.size()
|
|
|
|
|
MLOG_P2P_MESSAGE("-->>NOTIFY_REQUEST_GET_OBJECTS: blocks.size()=" << req.blocks.size()
|
|
|
|
|
<< "requested blocks count=" << count << " / " << count_limit << " from " << span.first << ", first hash " << req.blocks.front());
|
|
|
|
|
//epee::net_utils::network_throttle_manager::get_global_throttle_inreq().logger_handle_net("log/dr-monero/net/req-all.data", sec, get_avg_block_size());
|
|
|
|
|
|
|
|
|
|