forked from lthn/blockchain
Merge branch 'develop' into predevelop
This commit is contained in:
commit
4db837bbc7
17 changed files with 216 additions and 71 deletions
|
|
@ -925,6 +925,7 @@ using namespace std;
|
|||
class interruptible_http_client : public http_simple_client
|
||||
{
|
||||
std::shared_ptr<idle_handler_base> m_pcb;
|
||||
bool m_permanent_error = false;
|
||||
|
||||
virtual bool handle_target_data(std::string& piece_of_transfer)
|
||||
{
|
||||
|
|
@ -943,6 +944,7 @@ using namespace std;
|
|||
if (p_hri && !(p_hri->m_response_code >= 200 && p_hri->m_response_code < 300))
|
||||
{
|
||||
LOG_PRINT_L0("HTTP request to " << url << " failed with code: " << p_hri->m_response_code);
|
||||
m_permanent_error = true;
|
||||
return false;
|
||||
}
|
||||
return r;
|
||||
|
|
@ -1002,24 +1004,33 @@ using namespace std;
|
|||
};
|
||||
uint64_t current_err_count = 0;
|
||||
bool r = false;
|
||||
|
||||
m_permanent_error = false;
|
||||
while (!r && current_err_count < fails_count)
|
||||
{
|
||||
LOG_PRINT_L0("Attempt to invoke http: " << url << " (offset:" << state_received_bytes_base << ")");
|
||||
LOG_PRINT_L0("Attempt " << current_err_count + 1 << "/" << fails_count << " to get " << url << " (offset:" << state_received_bytes_base << ")");
|
||||
fields_list additional_params_local = additional_params;
|
||||
additional_params_local.push_back(std::make_pair<std::string, std::string>("Range", std::string("bytes=") + std::to_string(state_received_bytes_base) + "-"));
|
||||
r = this->invoke_cb(local_cb, url, timeout, method, body, additional_params_local);
|
||||
if (!r)
|
||||
{
|
||||
if (stopped)
|
||||
if (stopped || m_permanent_error)
|
||||
break;
|
||||
current_err_count++;
|
||||
state_received_bytes_base += state_received_bytes_current;
|
||||
state_received_bytes_current = 0;
|
||||
boost::this_thread::sleep_for(boost::chrono::milliseconds(500));
|
||||
boost::this_thread::sleep_for(boost::chrono::milliseconds(2000));
|
||||
}
|
||||
}
|
||||
|
||||
if (current_err_count >= fails_count)
|
||||
{
|
||||
LOG_PRINT_YELLOW("Downloading from " << url << " FAILED as it's reached maximum (" << fails_count << ") number of attempts. Downloaded " << state_received_bytes_base << " bytes.", LOG_LEVEL_0);
|
||||
}
|
||||
else if (m_permanent_error)
|
||||
{
|
||||
LOG_PRINT_YELLOW("Downloading from " << url << " FAILED due to permanent HTTP error. Downloaded " << state_received_bytes_base << " bytes.", LOG_LEVEL_0);
|
||||
}
|
||||
|
||||
fs.close();
|
||||
return r;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -149,7 +149,7 @@ epoch_context_full* create_epoch_context(
|
|||
LOG_CUSTOM_WITH_CALLSTACK("CRITICAL: std::calloc(" << alloc_size << ") failed in create_epoch_context()", 0);
|
||||
return nullptr; // Signal out-of-memory by returning null pointer.
|
||||
}
|
||||
LOG_CUSTOM("context for epoch " << epoch_number << " allocated, size: " << alloc_size << " bytes", 0);
|
||||
LOG_CUSTOM("context for epoch " << epoch_number << " allocated, size: " << alloc_size << " bytes, full dataset size: " << full_dataset_size << " bytes", 0);
|
||||
|
||||
hash512* const light_cache = reinterpret_cast<hash512*>(alloc_data + context_alloc_size);
|
||||
const hash256 epoch_seed = calculate_epoch_seed(epoch_number);
|
||||
|
|
|
|||
|
|
@ -105,6 +105,11 @@ namespace tools
|
|||
|
||||
std::string get_callstack_win_x64()
|
||||
{
|
||||
// @TODO@
|
||||
// static epee::static_helpers::wrapper<std::recursive_mutex> cs;
|
||||
static std::recursive_mutex cs;
|
||||
std::lock_guard<std::recursive_mutex> lock(cs);
|
||||
|
||||
HANDLE h_process = GetCurrentProcess();
|
||||
HANDLE h_thread = GetCurrentThread();
|
||||
|
||||
|
|
|
|||
|
|
@ -913,28 +913,48 @@ namespace tools
|
|||
{
|
||||
typedef basic_key_value_accessor<composite_key<t_key, uint64_t>, t_value, is_t_access_strategy> basic_accessor_type;
|
||||
|
||||
// template<class t_key>
|
||||
solo_db_value<composite_key<t_key, guid_key>, uint64_t, basic_accessor_type>
|
||||
get_counter_accessor(const t_key& container_id)
|
||||
get_counter_accessor(const t_key& container_id)
|
||||
{
|
||||
|
||||
static_assert(std::is_pod<t_key>::value, "t_pod_key must be a POD type.");
|
||||
composite_key<t_key, guid_key> cc = { container_id, const_counter_suffix};
|
||||
|
||||
return solo_db_value<composite_key<t_key, guid_key>, uint64_t, basic_accessor_type >(cc, *this);
|
||||
}
|
||||
|
||||
// template<class t_key>
|
||||
const solo_db_value<composite_key<t_key, guid_key>, uint64_t, basic_accessor_type >
|
||||
get_counter_accessor(const t_key& container_id) const
|
||||
get_counter_accessor(const t_key& container_id) const
|
||||
{
|
||||
static_assert(std::is_pod<t_key>::value, "t_pod_key must be a POD type.");
|
||||
composite_key<t_key, guid_key> cc = { container_id, const_counter_suffix };
|
||||
|
||||
static_assert(std::is_pod<t_key>::value, "t_pod_key must be a POD type.");
|
||||
composite_key<t_key, guid_key> cc = { container_id, const_counter_suffix };
|
||||
return solo_db_value<composite_key<t_key, guid_key>, uint64_t, basic_accessor_type >(cc, const_cast<basic_accessor_type&>(static_cast<const basic_accessor_type&>(*this)));
|
||||
}
|
||||
|
||||
return solo_db_value<composite_key<t_key, guid_key>, uint64_t, basic_accessor_type >(cc, const_cast<basic_accessor_type&>(static_cast<const basic_accessor_type&>(*this)));
|
||||
template<typename callback_t>
|
||||
struct subitems_visitor : public i_db_callback
|
||||
{
|
||||
subitems_visitor(callback_t cb)
|
||||
: m_callback(cb)
|
||||
{}
|
||||
|
||||
virtual bool on_enum_item(uint64_t i, const void* key_data, uint64_t key_size, const void* value_data, uint64_t value_size) override
|
||||
{
|
||||
if (key_size != sizeof(composite_key<t_key, uint64_t>))
|
||||
return true; // skip solo values containing items size
|
||||
|
||||
composite_key<t_key, uint64_t> key = AUTO_VAL_INIT(key);
|
||||
key_from_ptr(key, key_data, key_size);
|
||||
|
||||
t_value value = AUTO_VAL_INIT(value);
|
||||
access_strategy_selector<is_t_access_strategy>::from_buff_to_obj(value_data, value_size, value);
|
||||
|
||||
return m_callback(i, key.container_id, key.sufix, value);
|
||||
}
|
||||
|
||||
callback_t m_callback;
|
||||
};
|
||||
|
||||
public:
|
||||
basic_key_to_array_accessor(basic_db_accessor& db) : basic_key_value_accessor<composite_key<t_key, uint64_t>, t_value, is_t_access_strategy>(db)
|
||||
{}
|
||||
|
|
@ -991,6 +1011,14 @@ namespace tools
|
|||
|
||||
counter = 0;
|
||||
}
|
||||
|
||||
template<typename callback_t>
|
||||
void enumerate_subitems(callback_t callback) const
|
||||
{
|
||||
subitems_visitor<callback_t> visitor(callback);
|
||||
basic_accessor_type::bdb.get_backend()->enumerate(basic_accessor_type::m_h, &visitor);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
/************************************************************************/
|
||||
|
|
|
|||
|
|
@ -21,8 +21,8 @@ namespace tools
|
|||
};
|
||||
|
||||
#ifndef TESTNET
|
||||
static constexpr pre_download_entry c_pre_download_lmdb = { "http://95.217.43.225/pre-download/zano_lmdb_94_425000.pak", "e6ac69dcf8e7a7017d032cb4326d661c541a3b6a328e6299e6d61c3acde5d49f", 684683820, 1021865984 };
|
||||
static constexpr pre_download_entry c_pre_download_mdbx = { "http://95.217.43.225/pre-download/zano_mdbx_94_425000.pak", "e1f50efba1149a349eb626037dda30052c0233091693a00a10dd5363d5de1206", 535268266, 1073725440 };
|
||||
static constexpr pre_download_entry c_pre_download_lmdb = { "http://95.217.43.225/pre-download/zano_lmdb_94_524999.pak", "ac46a4932813e28fe11ec160a2be4e48c961dce701ecace5133184cff2754d3d", 747173581, 1087696896 };
|
||||
static constexpr pre_download_entry c_pre_download_mdbx = { "http://95.217.43.225/pre-download/zano_mdbx_94_524999.pak", "b195fdc1bda7173469db0b313f2ead2dbda1788639ba0aedb7001a6cc640fc47", 561335640, 1342156800 };
|
||||
#else
|
||||
static constexpr pre_download_entry c_pre_download_lmdb = { "http://95.217.43.225/pre-download/zano_testnet_lmdb_96_99000.pak", "9e8522b287ac7637ca770970542e94702f9fbaa267633cfcaeee4383dfe15bd0", 83851119, 131493888 };
|
||||
static constexpr pre_download_entry c_pre_download_mdbx = { "http://95.217.43.225/pre-download/zano_testnet_mdbx_96_99000.pak", "de33646711f2276e5b22db5741d7b2bf6a8e4c4231d393b730f9a4fce1d7ec03", 63257747, 268431360 };
|
||||
|
|
@ -88,7 +88,7 @@ namespace tools
|
|||
};
|
||||
|
||||
tools::create_directories_if_necessary(working_folder);
|
||||
r = cl.download_and_unzip(cb, downloading_file_path, url, 1000 /* timout */, "GET", std::string(), 3 /* fails count */);
|
||||
r = cl.download_and_unzip(cb, downloading_file_path, url, 5000 /* timout */, "GET", std::string(), 30 /* fails count */);
|
||||
if (!r)
|
||||
{
|
||||
LOG_PRINT_RED("Download failed", LOG_LEVEL_0);
|
||||
|
|
|
|||
|
|
@ -298,11 +298,19 @@ bool blockchain_storage::init(const std::string& config_folder, const boost::pro
|
|||
bool need_reinit = false;
|
||||
if (m_db_blocks.size() != 0)
|
||||
{
|
||||
#ifndef TESTNET
|
||||
if (m_db_storage_major_compatibility_version == 93 && BLOCKCHAIN_STORAGE_MAJOR_COMPATIBILITY_VERSION == 94)
|
||||
{
|
||||
// do not reinit db if moving from version 93 to version 94
|
||||
LOG_PRINT_MAGENTA("DB storage does not need reinit because moving from v93 to v94", LOG_LEVEL_0);
|
||||
}
|
||||
#else
|
||||
if (m_db_storage_major_compatibility_version == 95 && BLOCKCHAIN_STORAGE_MAJOR_COMPATIBILITY_VERSION == 96)
|
||||
{
|
||||
// do not reinit TESTNET db if moving from version 95 to version 96
|
||||
LOG_PRINT_MAGENTA("DB storage does not need reinit because moving from v95 to v96", LOG_LEVEL_0);
|
||||
}
|
||||
#endif
|
||||
else if (m_db_storage_major_compatibility_version != BLOCKCHAIN_STORAGE_MAJOR_COMPATIBILITY_VERSION)
|
||||
{
|
||||
need_reinit = true;
|
||||
|
|
@ -1535,7 +1543,6 @@ bool blockchain_storage::purge_altblock_keyimages_from_big_heap(const block& b,
|
|||
std::shared_ptr<transaction> tx_ptr;
|
||||
if (!get_transaction_from_pool_or_db(tx_id, tx_ptr))
|
||||
{
|
||||
LOG_ERROR("failed to get alt block tx " << tx_id << " on block detach from alts");
|
||||
continue;
|
||||
}
|
||||
transaction& tx = *tx_ptr;
|
||||
|
|
@ -2829,45 +2836,75 @@ void blockchain_storage::print_last_n_difficulty_numbers(uint64_t n) const
|
|||
LOG_PRINT_L0("LAST BLOCKS:" << ss.str());
|
||||
}
|
||||
//------------------------------------------------------------------
|
||||
void blockchain_storage::print_blockchain_outs_stat() const
|
||||
void blockchain_storage::print_blockchain_outs_stats() const
|
||||
{
|
||||
LOG_ERROR("NOT IMPLEMENTED YET");
|
||||
// std::stringstream ss;
|
||||
// CRITICAL_REGION_LOCAL(m_blockchain_lock);
|
||||
// BOOST_FOREACH(const outputs_container::value_type& v, m_db_outputs)
|
||||
// {
|
||||
// const std::vector<std::pair<crypto::hash, size_t> >& vals = v.second;
|
||||
// if (vals.size())
|
||||
// {
|
||||
// ss << "amount: " << print_money(v.first);
|
||||
// uint64_t total_count = vals.size();
|
||||
// uint64_t unused_count = 0;
|
||||
// for (size_t i = 0; i != vals.size(); i++)
|
||||
// {
|
||||
// bool used = false;
|
||||
// auto it_tx = m_db_transactions.find(vals[i].first);
|
||||
// if (it_tx == m_db_transactions.end())
|
||||
// {
|
||||
// LOG_ERROR("Tx with id not found " << vals[i].first);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// if (vals[i].second >= it_tx->second.m_spent_flags.size())
|
||||
// {
|
||||
// LOG_ERROR("Tx with id " << vals[i].first << " in global index have wrong entry in global index, offset in tx = " << vals[i].second
|
||||
// << ", it_tx->second.m_spent_flags.size()=" << it_tx->second.m_spent_flags.size()
|
||||
// << ", it_tx->second.tx.vin.size()=" << it_tx->second.tx.vin.size());
|
||||
// }
|
||||
// used = it_tx->second.m_spent_flags[vals[i].second];
|
||||
//
|
||||
// }
|
||||
// if (!used)
|
||||
// ++unused_count;
|
||||
// }
|
||||
// ss << "\t total: " << total_count << "\t unused: " << unused_count << ENDL;
|
||||
// }
|
||||
// }
|
||||
// LOG_PRINT_L0("OUTS: " << ENDL << ss.str());
|
||||
std::stringstream ss;
|
||||
CRITICAL_REGION_LOCAL(m_read_lock);
|
||||
|
||||
struct output_stat_t
|
||||
{
|
||||
uint64_t total = 0;
|
||||
uint64_t unspent = 0;
|
||||
uint64_t mixable = 0;
|
||||
};
|
||||
|
||||
std::map<uint64_t, output_stat_t> outputs_stats;
|
||||
|
||||
const uint64_t subitems_cnt = m_db_outputs.size();
|
||||
uint64_t progress = 0;
|
||||
|
||||
auto lambda_handler = [&](uint64_t i, uint64_t amount, uint64_t index, const currency::global_output_entry& output_entry) -> bool
|
||||
{
|
||||
uint64_t progress_current = 20 * i / subitems_cnt;
|
||||
if (progress_current != progress)
|
||||
{
|
||||
progress = progress_current;
|
||||
LOG_PRINT_L0(progress * 5 << "%");
|
||||
}
|
||||
|
||||
auto p_tx = m_db_transactions.find(output_entry.tx_id);
|
||||
if (!p_tx)
|
||||
{
|
||||
LOG_ERROR("tx " << output_entry.tx_id << " not found");
|
||||
return true; // continue
|
||||
}
|
||||
if (output_entry.out_no >= p_tx->m_spent_flags.size())
|
||||
{
|
||||
LOG_ERROR("tx with id " << output_entry.tx_id << " has wrong entry in global index, out_no = " << output_entry.out_no
|
||||
<< ", p_tx->m_spent_flags.size() = " << p_tx->m_spent_flags.size()
|
||||
<< ", p_tx->tx.vin.size() = " << p_tx->tx.vin.size());
|
||||
return true; // continue
|
||||
}
|
||||
if (p_tx->tx.vout.size() != p_tx->m_spent_flags.size())
|
||||
{
|
||||
LOG_ERROR("Tx with id " << output_entry.tx_id << " has wrong entry in global index, out_no = " << output_entry.out_no
|
||||
<< ", p_tx->tx.vout.size() = " << p_tx->tx.vout.size()
|
||||
<< ", p_tx->m_spent_flags.size() = " << p_tx->m_spent_flags.size());
|
||||
return true; // continue
|
||||
}
|
||||
|
||||
auto& stat = outputs_stats[amount];
|
||||
++stat.total;
|
||||
|
||||
bool spent = p_tx->m_spent_flags[output_entry.out_no];
|
||||
if (!spent)
|
||||
++stat.unspent;
|
||||
|
||||
if (!spent && p_tx->tx.vout[output_entry.out_no].target.type() == typeid(txout_to_key))
|
||||
{
|
||||
if (boost::get<txout_to_key>(p_tx->tx.vout[output_entry.out_no].target).mix_attr != CURRENCY_TO_KEY_OUT_FORCED_NO_MIX)
|
||||
++stat.mixable;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
m_db_outputs.enumerate_subitems(lambda_handler);
|
||||
|
||||
ss << std::right << std::setw(15) << "amount" << std::setw(10) << "total" << std::setw(10) << "unspent" << std::setw(10) << "mixable" << ENDL;
|
||||
for(auto it = outputs_stats.begin(); it != outputs_stats.end(); ++it)
|
||||
ss << std::setw(15) << print_money_brief(it->first) << std::setw(10) << it->second.total << std::setw(10) << it->second.unspent << std::setw(10) << it->second.mixable << ENDL;
|
||||
|
||||
LOG_PRINT_L0("OUTS: " << ENDL << ss.str());
|
||||
}
|
||||
//------------------------------------------------------------------
|
||||
void blockchain_storage::print_blockchain_outs(const std::string& file) const
|
||||
|
|
@ -6094,7 +6131,11 @@ bool blockchain_storage::get_transaction_from_pool_or_db(const crypto::hash& tx_
|
|||
if (!m_tx_pool.get_transaction(tx_id, *tx_ptr)) // first try to get from the pool
|
||||
{
|
||||
auto p = m_db_transactions.get(tx_id); // if not found in the pool -- get from the DB
|
||||
CHECK_AND_ASSERT_MES(p != nullptr, false, "can't get tx " << tx_id << " neither from the pool, nor from db_transactions");
|
||||
if (p == nullptr)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
//CHECK_AND_ASSERT_MES(p != nullptr, false, "can't get tx " << tx_id << " neither from the pool, nor from db_transactions");
|
||||
CHECK_AND_ASSERT_MES(p->m_keeper_block_height >= min_allowed_block_height, false, "tx " << tx_id << " found in the main chain at height " << p->m_keeper_block_height << " while required min allowed height is " << min_allowed_block_height);
|
||||
*tx_ptr = p->tx;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -432,7 +432,7 @@ namespace currency
|
|||
void print_blockchain_with_tx(uint64_t start_index, uint64_t end_index) const;
|
||||
void print_blockchain_index() const;
|
||||
void print_blockchain_outs(const std::string& file) const;
|
||||
void print_blockchain_outs_stat() const;
|
||||
void print_blockchain_outs_stats() const;
|
||||
void print_db_cache_perfeormance_data() const;
|
||||
void print_last_n_difficulty_numbers(uint64_t n) const;
|
||||
bool calc_tx_cummulative_blob(const block& bl)const;
|
||||
|
|
|
|||
|
|
@ -19,9 +19,11 @@ namespace currency
|
|||
#ifdef TESTNET
|
||||
ADD_CHECKPOINT(50000, "cb05a7bdc7f78c5cdb6ef1048f85b27c569f44879233903ce5f5a4e5bd590a3d");
|
||||
ADD_CHECKPOINT(100000, "6b8b54356a9d44f6c1ebdacb8593d8f5ab2e2e2ca4493e7ae7baf4b3755c5e16");
|
||||
ADD_CHECKPOINT(350000, "885841f079e5a38f1921f4a5319f0d52fdbab64bb2026ca3cabad1c032d22db7");
|
||||
#else
|
||||
// MAINNET
|
||||
ADD_CHECKPOINT(425000, "46a6c36d5dec2d484d5e4845a8525ca322aafc06915ed9c8da2a241b51b7d1e8");
|
||||
ADD_CHECKPOINT(525000, "8c1ac57e67448130207a224b2d6e33ccdc64d6dd1c59dbcf9ad2361dc0d07d51");
|
||||
#endif
|
||||
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -98,12 +98,14 @@
|
|||
#define RPC_DEFAULT_PORT 11211
|
||||
#define STRATUM_DEFAULT_PORT 11777
|
||||
#define P2P_NETWORK_ID_TESTNET_FLAG 0
|
||||
#define P2P_MAINTAINERS_PUB_KEY "8f138bb73f6d663a3746a542770781a09579a7b84cb4125249e95530824ee607"
|
||||
#else
|
||||
#define P2P_DEFAULT_PORT (11112 + CURRENCY_FORMATION_VERSION)
|
||||
#define RPC_DEFAULT_PORT 12111
|
||||
#define STRATUM_DEFAULT_PORT 11888
|
||||
#define STRARUM_DEFAULT_PORT 51113
|
||||
#define P2P_NETWORK_ID_TESTNET_FLAG 1
|
||||
#define P2P_MAINTAINERS_PUB_KEY "aaa2d7aabc8d383fd53a3ae898697b28f236ceade6bafc1eecff413a6a02272a"
|
||||
#endif
|
||||
|
||||
#define P2P_NETWORK_ID_VER (CURRENCY_FORMATION_VERSION+0)
|
||||
|
|
@ -121,7 +123,6 @@
|
|||
#define P2P_DEFAULT_PING_CONNECTION_TIMEOUT 2000 //2 seconds
|
||||
#define P2P_DEFAULT_INVOKE_TIMEOUT 60*2*1000 //2 minutes
|
||||
#define P2P_DEFAULT_HANDSHAKE_INVOKE_TIMEOUT 10000 //10 seconds
|
||||
#define P2P_MAINTAINERS_PUB_KEY "8f138bb73f6d663a3746a542770781a09579a7b84cb4125249e95530824ee607"
|
||||
#define P2P_DEFAULT_WHITELIST_CONNECTIONS_PERCENT 70
|
||||
#define P2P_FAILED_ADDR_FORGET_SECONDS (60*5) //5 minutes
|
||||
|
||||
|
|
|
|||
|
|
@ -70,6 +70,8 @@ namespace currency
|
|||
int64_t get_net_time_delta_median();
|
||||
bool add_time_delta_and_check_time_sync(int64_t delta);
|
||||
bool get_last_time_sync_difference(int64_t& last_median2local_time_difference, int64_t& last_ntp2local_time_difference); // returns true if differences in allowed bounds
|
||||
//-----------------------------------------------------------------------------------
|
||||
void set_to_debug_mode(uint32_t ip);
|
||||
|
||||
private:
|
||||
//----------------- commands handlers ----------------------------------------------
|
||||
|
|
@ -114,6 +116,7 @@ namespace currency
|
|||
std::mutex m_time_deltas_lock;
|
||||
int64_t m_last_median2local_time_difference;
|
||||
int64_t m_last_ntp2local_time_difference;
|
||||
uint32_t m_debug_ip_address;
|
||||
|
||||
template<class t_parametr>
|
||||
bool post_notify(typename t_parametr::request& arg, currency_connection_context& context)
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ namespace currency
|
|||
, m_want_stop(false)
|
||||
, m_last_median2local_time_difference(0)
|
||||
, m_last_ntp2local_time_difference(0)
|
||||
, m_debug_ip_address(0)
|
||||
{
|
||||
if(!m_p2p)
|
||||
m_p2p = &m_p2p_stub;
|
||||
|
|
@ -241,6 +242,10 @@ namespace currency
|
|||
template<class t_core>
|
||||
int t_currency_protocol_handler<t_core>::handle_notify_new_block(int command, NOTIFY_NEW_BLOCK::request& arg, currency_connection_context& context)
|
||||
{
|
||||
//do not process requests if it comes from node wich is debugged
|
||||
if (m_debug_ip_address != 0 && context.m_remote_ip == m_debug_ip_address)
|
||||
return 1;
|
||||
|
||||
if(context.m_state != currency_connection_context::state_normal)
|
||||
return 1;
|
||||
|
||||
|
|
@ -363,6 +368,10 @@ namespace currency
|
|||
template<class t_core>
|
||||
int t_currency_protocol_handler<t_core>::handle_notify_new_transactions(int command, NOTIFY_NEW_TRANSACTIONS::request& arg, currency_connection_context& context)
|
||||
{
|
||||
//do not process requests if it comes from node wich is debugged
|
||||
if (m_debug_ip_address != 0 && context.m_remote_ip == m_debug_ip_address)
|
||||
return 1;
|
||||
|
||||
if(context.m_state != currency_connection_context::state_normal)
|
||||
return 1;
|
||||
uint64_t inital_tx_count = arg.txs.size();
|
||||
|
|
@ -400,6 +409,10 @@ namespace currency
|
|||
template<class t_core>
|
||||
int t_currency_protocol_handler<t_core>::handle_request_get_objects(int command, NOTIFY_REQUEST_GET_OBJECTS::request& arg, currency_connection_context& context)
|
||||
{
|
||||
//do not process requests if it comes from node wich is debugged
|
||||
if (m_debug_ip_address != 0 && context.m_remote_ip == m_debug_ip_address)
|
||||
return 1;
|
||||
|
||||
LOG_PRINT_L2("[HANDLE]NOTIFY_REQUEST_GET_OBJECTS: arg.blocks.size() = " << arg.blocks.size() << ", arg.txs.size()="<< arg.txs.size());
|
||||
LOG_PRINT_L3("[HANDLE]NOTIFY_REQUEST_GET_OBJECTS: " << ENDL << currency::print_kv_structure(arg));
|
||||
|
||||
|
|
@ -445,6 +458,10 @@ namespace currency
|
|||
template<class t_core>
|
||||
int t_currency_protocol_handler<t_core>::handle_response_get_objects(int command, NOTIFY_RESPONSE_GET_OBJECTS::request& arg, currency_connection_context& context)
|
||||
{
|
||||
//do not process requests if it comes from node wich is debugged
|
||||
if (m_debug_ip_address != 0 && context.m_remote_ip == m_debug_ip_address)
|
||||
return 1;
|
||||
|
||||
LOG_PRINT_L2("[HANDLE]NOTIFY_RESPONSE_GET_OBJECTS: arg.blocks.size()=" << arg.blocks.size() << ", arg.missed_ids.size()=" << arg.missed_ids.size() << ", arg.txs.size()=" << arg.txs.size());
|
||||
LOG_PRINT_L3("[HANDLE]NOTIFY_RESPONSE_GET_OBJECTS: " << ENDL << currency::print_kv_structure(arg));
|
||||
if(context.m_last_response_height > arg.current_blockchain_height)
|
||||
|
|
@ -627,6 +644,10 @@ namespace currency
|
|||
template<class t_core>
|
||||
int t_currency_protocol_handler<t_core>::handle_request_chain(int command, NOTIFY_REQUEST_CHAIN::request& arg, currency_connection_context& context)
|
||||
{
|
||||
//do not process requests if it comes from node wich is debugged
|
||||
if (m_debug_ip_address != 0 && context.m_remote_ip == m_debug_ip_address)
|
||||
return 1;
|
||||
|
||||
LOG_PRINT_L2("[HANDLE]NOTIFY_REQUEST_CHAIN: block_ids.size()=" << arg.block_ids.size());
|
||||
LOG_PRINT_L3("[HANDLE]NOTIFY_REQUEST_CHAIN: " << print_kv_structure(arg));
|
||||
NOTIFY_RESPONSE_CHAIN_ENTRY::request r;
|
||||
|
|
@ -851,10 +872,20 @@ namespace currency
|
|||
|
||||
return !(std::abs(m_last_median2local_time_difference) > TIME_SYNC_DELTA_TO_LOCAL_MAX_DIFFERENCE && std::abs(m_last_ntp2local_time_difference) > TIME_SYNC_NTP_TO_LOCAL_MAX_DIFFERENCE);
|
||||
}
|
||||
template<class t_core>
|
||||
void t_currency_protocol_handler<t_core>::set_to_debug_mode(uint32_t ip)
|
||||
{
|
||||
m_debug_ip_address = ip;
|
||||
LOG_PRINT_L0("debug mode is set for IP " << epee::string_tools::get_ip_string_from_int32(m_debug_ip_address));
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------------------------------
|
||||
template<class t_core>
|
||||
int t_currency_protocol_handler<t_core>::handle_response_chain_entry(int command, NOTIFY_RESPONSE_CHAIN_ENTRY::request& arg, currency_connection_context& context)
|
||||
{
|
||||
//do not process requests if it comes from node wich is debugged
|
||||
if (m_debug_ip_address != 0 && context.m_remote_ip == m_debug_ip_address)
|
||||
return 1;
|
||||
|
||||
LOG_PRINT_L2("[HANDLE]NOTIFY_RESPONSE_CHAIN_ENTRY: m_block_ids.size()=" << arg.m_block_ids.size()
|
||||
<< ", m_start_height=" << arg.start_height << ", m_total_height=" << arg.total_height);
|
||||
LOG_PRINT_L3("[HANDLE]NOTIFY_RESPONSE_CHAIN_ENTRY: " << ENDL << currency::print_kv_structure(arg));
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@
|
|||
#include "warnings.h"
|
||||
#include "currency_core/bc_offers_service.h"
|
||||
#include "serialization/binary_utils.h"
|
||||
#include "simplewallet/password_container.h"
|
||||
|
||||
PUSH_VS_WARNINGS
|
||||
DISABLE_VS_WARNINGS(4100)
|
||||
|
|
@ -38,7 +39,7 @@ public:
|
|||
//m_cmd_binder.set_handler("print_bci", boost::bind(&daemon_commands_handler::print_bci, this, _1));
|
||||
m_cmd_binder.set_handler("print_bc_outs", boost::bind(&daemon_commands_handler::print_bc_outs, this, _1));
|
||||
m_cmd_binder.set_handler("print_market", boost::bind(&daemon_commands_handler::print_market, this, _1));
|
||||
m_cmd_binder.set_handler("print_bc_outs_stat", boost::bind(&daemon_commands_handler::print_bc_outs_stat, this, _1));
|
||||
m_cmd_binder.set_handler("print_bc_outs_stats", boost::bind(&daemon_commands_handler::print_bc_outs_stats, this, _1));
|
||||
m_cmd_binder.set_handler("print_block", boost::bind(&daemon_commands_handler::print_block, this, _1), "Print block, print_block <block_hash> | <block_height>");
|
||||
m_cmd_binder.set_handler("print_block_info", boost::bind(&daemon_commands_handler::print_block_info, this, _1), "Print block info, print_block <block_hash> | <block_height>");
|
||||
m_cmd_binder.set_handler("print_tx", boost::bind(&daemon_commands_handler::print_tx, this, _1), "Print transaction, print_tx <transaction_hash>");
|
||||
|
|
@ -69,7 +70,7 @@ public:
|
|||
m_cmd_binder.set_handler("print_tx_from_hex_blob", boost::bind(&daemon_commands_handler::print_tx_from_hex_blob, this, _1), "Unserialize transaction from hex binary data to json-like representation");
|
||||
m_cmd_binder.set_handler("print_tx_outputs_usage", boost::bind(&daemon_commands_handler::print_tx_outputs_usage, this, _1), "Analyse if tx outputs for involved in subsequent transactions");
|
||||
m_cmd_binder.set_handler("print_difficulties_of_last_n_blocks", boost::bind(&daemon_commands_handler::print_difficulties_of_last_n_blocks, this, _1), "Print difficulties of last n blocks");
|
||||
|
||||
m_cmd_binder.set_handler("debug_remote_node_mode", boost::bind(&daemon_commands_handler::debug_remote_node_mode, this, _1), "<ip-address> - If node got connected put node into 'debug mode' i.e. no sync process of other communication except ping responses, maintenance secrete key will be requested");
|
||||
#ifdef _DEBUG
|
||||
m_cmd_binder.set_handler("debug_set_time_adj", boost::bind(&daemon_commands_handler::debug_set_time_adj, this, _1), "DEBUG: set core time adjustment");
|
||||
#endif
|
||||
|
|
@ -217,9 +218,9 @@ private:
|
|||
return true;
|
||||
}
|
||||
//--------------------------------------------------------------------------------
|
||||
bool print_bc_outs_stat(const std::vector<std::string>& args)
|
||||
bool print_bc_outs_stats(const std::vector<std::string>& args)
|
||||
{
|
||||
m_srv.get_payload_object().get_core().get_blockchain_storage().print_blockchain_outs_stat();
|
||||
m_srv.get_payload_object().get_core().get_blockchain_storage().print_blockchain_outs_stats();
|
||||
return true;
|
||||
}
|
||||
//--------------------------------------------------------------------------------
|
||||
|
|
@ -734,6 +735,24 @@ private:
|
|||
return true;
|
||||
}
|
||||
//--------------------------------------------------------------------------------
|
||||
bool debug_remote_node_mode(const std::vector<std::string>& args)
|
||||
{
|
||||
if (args.empty())
|
||||
{
|
||||
std::cout << "expected: ip address" << std::endl;
|
||||
return true;
|
||||
}
|
||||
uint32_t ip = AUTO_VAL_INIT(ip);
|
||||
if (!string_tools::get_ip_int32_from_string(ip, args.front()))
|
||||
{
|
||||
std::cout << "expected: ip address" << std::endl;
|
||||
return true;
|
||||
}
|
||||
m_srv.get_payload_object().set_to_debug_mode(ip);
|
||||
|
||||
return true;
|
||||
}
|
||||
//--------------------------------------------------------------------------------
|
||||
bool print_pool(const std::vector<std::string>& args)
|
||||
{
|
||||
LOG_PRINT_L0("Pool state: " << ENDL << m_srv.get_payload_object().get_core().print_pool(false));
|
||||
|
|
|
|||
|
|
@ -7214,7 +7214,7 @@ var SendComponent = /** @class */ (function () {
|
|||
return null;
|
||||
}]),
|
||||
comment: new _angular_forms__WEBPACK_IMPORTED_MODULE_1__["FormControl"](''),
|
||||
mixin: new _angular_forms__WEBPACK_IMPORTED_MODULE_1__["FormControl"](0, _angular_forms__WEBPACK_IMPORTED_MODULE_1__["Validators"].required),
|
||||
mixin: new _angular_forms__WEBPACK_IMPORTED_MODULE_1__["FormControl"](10, _angular_forms__WEBPACK_IMPORTED_MODULE_1__["Validators"].required),
|
||||
fee: new _angular_forms__WEBPACK_IMPORTED_MODULE_1__["FormControl"](this.variablesService.default_fee, [_angular_forms__WEBPACK_IMPORTED_MODULE_1__["Validators"].required, function (g) {
|
||||
if ((new bignumber_js__WEBPACK_IMPORTED_MODULE_6__["BigNumber"](g.value)).isLessThan(_this.variablesService.default_fee)) {
|
||||
return { 'less_min': true };
|
||||
|
|
@ -7246,7 +7246,7 @@ var SendComponent = /** @class */ (function () {
|
|||
address: _this.variablesService.currentWallet.send_data['address'],
|
||||
amount: _this.variablesService.currentWallet.send_data['amount'],
|
||||
comment: _this.variablesService.currentWallet.send_data['comment'],
|
||||
mixin: _this.variablesService.currentWallet.send_data['mixin'] || 0,
|
||||
mixin: _this.variablesService.currentWallet.send_data['mixin'] || 10,
|
||||
fee: _this.variablesService.currentWallet.send_data['fee'] || _this.variablesService.default_fee,
|
||||
hide: _this.variablesService.currentWallet.send_data['hide'] || false
|
||||
});
|
||||
|
|
@ -7276,7 +7276,7 @@ var SendComponent = /** @class */ (function () {
|
|||
if (send_status) {
|
||||
_this.modalService.prepareModal('success', 'SEND.SUCCESS_SENT');
|
||||
_this.variablesService.currentWallet.send_data = { address: null, amount: null, comment: null, mixin: null, fee: null, hide: null };
|
||||
_this.sendForm.reset({ address: null, amount: null, comment: null, mixin: 0, fee: _this.variablesService.default_fee, hide: false });
|
||||
_this.sendForm.reset({ address: null, amount: null, comment: null, mixin: 10, fee: _this.variablesService.default_fee, hide: false });
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
@ -7296,7 +7296,7 @@ var SendComponent = /** @class */ (function () {
|
|||
if (send_status) {
|
||||
_this.modalService.prepareModal('success', 'SEND.SUCCESS_SENT');
|
||||
_this.variablesService.currentWallet.send_data = { address: null, amount: null, comment: null, mixin: null, fee: null, hide: null };
|
||||
_this.sendForm.reset({ address: null, amount: null, comment: null, mixin: 0, fee: _this.variablesService.default_fee, hide: false });
|
||||
_this.sendForm.reset({ address: null, amount: null, comment: null, mixin: 10, fee: _this.variablesService.default_fee, hide: false });
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -82,7 +82,6 @@ namespace nodetool
|
|||
m_use_only_priority_peers(false),
|
||||
m_peer_livetime{},
|
||||
m_debug_requests_enabled(false)
|
||||
|
||||
{}
|
||||
|
||||
static void init_options(boost::program_options::options_description& desc);
|
||||
|
|
@ -248,6 +247,7 @@ namespace nodetool
|
|||
bool m_debug_requests_enabled;
|
||||
uint64_t m_startup_time;
|
||||
|
||||
|
||||
//critical_section m_connections_lock;
|
||||
//connections_indexed_container m_connections;
|
||||
|
||||
|
|
|
|||
|
|
@ -1396,7 +1396,7 @@ namespace nodetool
|
|||
get_local_node_data(rsp.node_data);
|
||||
m_payload_handler.get_payload_sync_data(rsp.payload_data);
|
||||
fill_maintainers_entry(rsp.maintrs_entry);
|
||||
LOG_PRINT_GREEN("COMMAND_HANDSHAKE", LOG_LEVEL_1);
|
||||
LOG_PRINT_GREEN("COMMAND_HANDSHAKE: v" << arg.payload_data.client_version << " top: " << epee::string_tools::pod_to_hex(arg.payload_data.top_id).substr(0, 6) << " @ " << arg.payload_data.current_height - 1, LOG_LEVEL_1);
|
||||
return 1;
|
||||
}
|
||||
//-----------------------------------------------------------------------------------
|
||||
|
|
@ -1442,6 +1442,7 @@ namespace nodetool
|
|||
std::string s = ss.str();
|
||||
return s;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------
|
||||
template<class t_payload_net_handler>
|
||||
void node_server<t_payload_net_handler>::on_connection_new(p2p_connection_context& context)
|
||||
|
|
|
|||
|
|
@ -5,9 +5,9 @@
|
|||
|
||||
#define PROJECT_MAJOR_VERSION "1"
|
||||
#define PROJECT_MINOR_VERSION "1"
|
||||
#define PROJECT_REVISION "5"
|
||||
#define PROJECT_REVISION "6"
|
||||
#define PROJECT_VERSION PROJECT_MAJOR_VERSION "." PROJECT_MINOR_VERSION "." PROJECT_REVISION
|
||||
|
||||
#define PROJECT_VERSION_BUILD_NO 82
|
||||
#define PROJECT_VERSION_BUILD_NO 87
|
||||
#define PROJECT_VERSION_BUILD_NO_STR STRINGIFY_EXPAND(PROJECT_VERSION_BUILD_NO)
|
||||
#define PROJECT_VERSION_LONG PROJECT_VERSION "." PROJECT_VERSION_BUILD_NO_STR "[" BUILD_COMMIT_ID "]"
|
||||
|
|
|
|||
|
|
@ -350,7 +350,10 @@ bool wallets_manager::init_local_daemon()
|
|||
|
||||
return static_cast<bool>(m_stop_singal_sent);
|
||||
});
|
||||
CHECK_AND_ASSERT_AND_SET_GUI(res, "pre-downloading failed");
|
||||
if (!res)
|
||||
{
|
||||
LOG_PRINT_RED("pre-downloading failed, continue with normal network synchronization", LOG_LEVEL_0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue