mirror of
https://github.com/monero-project/monero.git
synced 2025-07-24 20:55:21 -04:00
2014 network limit 1.0a +utils +toc -doc -drmonero
commands and options for network limiting works very well e.g. for 50 KiB/sec up and down ToS (QoS) flag peer number limit TODO some spikes in ingress/download TODO problems when other up and down limit added "otshell utils" - simple logging (with colors, text files channels)
This commit is contained in:
parent
e728992803
commit
eabb519605
40 changed files with 4016 additions and 206 deletions
|
@ -70,6 +70,7 @@ target_link_libraries(cryptonote_core
|
|||
LINK_PUBLIC
|
||||
common
|
||||
crypto
|
||||
otshell_utils
|
||||
${Boost_DATE_TIME_LIBRARY}
|
||||
${Boost_PROGRAM_OPTIONS_LIBRARY}
|
||||
${Boost_SERIALIZATION_LIBRARY}
|
||||
|
|
|
@ -49,6 +49,7 @@
|
|||
#include "crypto/hash.h"
|
||||
#include "cryptonote_core/checkpoints_create.h"
|
||||
//#include "serialization/json_archive.h"
|
||||
#include "../../contrib/otshell_utils/utils.hpp"
|
||||
|
||||
using namespace cryptonote;
|
||||
|
||||
|
@ -1153,6 +1154,31 @@ uint64_t blockchain_storage::block_difficulty(size_t i)
|
|||
return m_blocks[i].cumulative_difficulty - m_blocks[i-1].cumulative_difficulty;
|
||||
}
|
||||
//------------------------------------------------------------------
|
||||
double blockchain_storage::get_avg_block_size( size_t count)
|
||||
{
|
||||
if (count > get_current_blockchain_height()) return 500;
|
||||
|
||||
double average = 0;
|
||||
_dbg1_c("net/blksize", "HEIGHT: " << get_current_blockchain_height());
|
||||
_dbg1_c("net/blksize", "BLOCK ID BY HEIGHT: " << get_block_id_by_height(get_current_blockchain_height()) );
|
||||
_dbg1_c("net/blksize", "BLOCK TAIL ID: " << get_tail_id() );
|
||||
std::vector<size_t> size_vector;
|
||||
|
||||
get_backward_blocks_sizes(get_current_blockchain_height() - count, size_vector, count);
|
||||
|
||||
std::vector<size_t>::iterator it;
|
||||
it = size_vector.begin();
|
||||
while (it != size_vector.end()) {
|
||||
average += *it;
|
||||
_dbg2_c("net/blksize", "VECTOR ELEMENT: " << (*it) );
|
||||
it++;
|
||||
}
|
||||
average = average / count;
|
||||
_dbg1_c("net/blksize", "VECTOR SIZE: " << size_vector.size() << " average=" << average);
|
||||
|
||||
return average;
|
||||
}
|
||||
//------------------------------------------------------------------
|
||||
void blockchain_storage::print_blockchain(uint64_t start_index, uint64_t end_index)
|
||||
{
|
||||
std::stringstream ss;
|
||||
|
|
|
@ -134,6 +134,7 @@ namespace cryptonote
|
|||
uint64_t get_current_comulative_blocksize_limit();
|
||||
bool is_storing_blockchain(){return m_is_blockchain_storing;}
|
||||
uint64_t block_difficulty(size_t i);
|
||||
double get_avg_block_size( size_t count);
|
||||
|
||||
template<class t_ids_container, class t_blocks_container, class t_missed_container>
|
||||
bool get_blocks(const t_ids_container& block_ids, t_blocks_container& blocks, t_missed_container& missed_bs)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue