forked from lthn/blockchain
Merge remote-tracking branch 'origin/develop' into frontend
This commit is contained in:
commit
a31178a4db
5 changed files with 37 additions and 29 deletions
|
|
@ -55,7 +55,7 @@ namespace
|
|||
const command_line::arg_descriptor<uint64_t> arg_genesis_split_amount = { "genesis-split-amount", "Set split amount for generating genesis block", 0, true };
|
||||
const command_line::arg_descriptor<std::string> arg_get_info_flags = { "getinfo-flags-hex", "Set of bits for rpc-get-daemon-info", "", true };
|
||||
const command_line::arg_descriptor<int64_t> arg_set_peer_log_level = { "set-peer-log-level", "Set log level for remote peer", 0, true };
|
||||
const command_line::arg_descriptor<uint64_t> arg_download_peer_log = { "download-peer-log", "Download log from remote peer (starting offset)", 0, true };
|
||||
const command_line::arg_descriptor<std::string> arg_download_peer_log = { "download-peer-log", "Download log from remote peer <starting_offset>[,<count>]", "", true };
|
||||
const command_line::arg_descriptor<bool> arg_do_consloe_log = { "do-console-log", "Tool generates debug console output(debug purposes)", "", true };
|
||||
}
|
||||
|
||||
|
|
@ -931,7 +931,27 @@ bool handle_download_peer_log(po::variables_map& vm)
|
|||
return false;
|
||||
}
|
||||
|
||||
uint64_t start_offset = command_line::get_arg(vm, arg_download_peer_log);
|
||||
int64_t start_offset = 0;
|
||||
int64_t count = -1;
|
||||
|
||||
std::string arg_str = command_line::get_arg(vm, arg_download_peer_log);
|
||||
size_t comma_pos = arg_str.find(',');
|
||||
if (comma_pos != std::string::npos)
|
||||
{
|
||||
// count is specified
|
||||
if (!epee::string_tools::string_to_num_fast(arg_str.substr(comma_pos + 1), count) || count < 0)
|
||||
{
|
||||
std::cout << "ERROR: invalid argument: " << arg_str << ENDL;
|
||||
return false;
|
||||
}
|
||||
arg_str.erase(comma_pos);
|
||||
}
|
||||
if (!epee::string_tools::string_to_num_fast(arg_str, start_offset) || start_offset < 0)
|
||||
{
|
||||
std::cout << "ERROR: couldn't parse start_offset: " << arg_str << ENDL;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
levin::levin_client_impl2 transport;
|
||||
peerid_type peer_id = 0;
|
||||
|
|
@ -947,6 +967,9 @@ bool handle_download_peer_log(po::variables_map& vm)
|
|||
std::cout << "Current log level: " << rsp.current_log_level << ENDL;
|
||||
std::cout << "Current log size: " << rsp.current_log_size << ENDL;
|
||||
|
||||
if (start_offset == 0 && count == 0)
|
||||
return true; // a caller wanted to just get the info, end of story
|
||||
|
||||
if (start_offset >= rsp.current_log_size)
|
||||
{
|
||||
std::cout << "ERROR: invalid start offset: " << start_offset << ", log size: " << rsp.current_log_size << ENDL;
|
||||
|
|
@ -969,6 +992,13 @@ bool handle_download_peer_log(po::variables_map& vm)
|
|||
{
|
||||
req.log_chunk_offset = end_offset;
|
||||
req.log_chunk_size = std::min(chunk_size, rsp.current_log_size - req.log_chunk_offset);
|
||||
|
||||
if (count > 0)
|
||||
{
|
||||
uint64_t bytes_left = count + start_offset - end_offset;
|
||||
req.log_chunk_size = std::min(req.log_chunk_size, bytes_left);
|
||||
}
|
||||
|
||||
if (req.log_chunk_size == 0)
|
||||
break;
|
||||
|
||||
|
|
|
|||
|
|
@ -2213,31 +2213,6 @@ bool blockchain_storage::is_multisig_output_spent(const crypto::hash& multisig_i
|
|||
return source_tx_ptr->m_spent_flags[ms_out_index];
|
||||
}
|
||||
//------------------------------------------------------------------
|
||||
// bool blockchain_storage::resync_spent_tx_flags()
|
||||
// {
|
||||
// LOG_PRINT_L0("Started re-building spent tx outputs data...");
|
||||
// CRITICAL_REGION_LOCAL(m_blockchain_lock);
|
||||
// for(auto& tx: m_db_transactions)
|
||||
// {
|
||||
// if(is_coinbase(tx.second.tx))
|
||||
// continue;
|
||||
//
|
||||
// for(auto& in: tx.second.tx.vin)
|
||||
// {
|
||||
// CHECKED_GET_SPECIFIC_VARIANT(in, txin_to_key, in_to_key, false);
|
||||
// if(in_to_key.key_offsets.size() != 1)
|
||||
// continue;
|
||||
//
|
||||
// //direct spending
|
||||
// if(!update_spent_tx_flags_for_input(in_to_key.amount, in_to_key.key_offsets[0], true))
|
||||
// return false;
|
||||
//
|
||||
// }
|
||||
// }
|
||||
// LOG_PRINT_L0("Finished re-building spent tx outputs data");
|
||||
// return true;
|
||||
// }
|
||||
//------------------------------------------------------------------
|
||||
bool blockchain_storage::find_blockchain_supplement(const std::list<crypto::hash>& qblock_ids, uint64_t& starter_offset)const
|
||||
{
|
||||
CRITICAL_REGION_LOCAL(m_read_lock);
|
||||
|
|
|
|||
|
|
@ -1546,7 +1546,7 @@ void daemon_backend::wallet_vs_options::worker_func()
|
|||
{
|
||||
w->get()->build_minted_block(ctx.sp, ctx.rsp);
|
||||
}
|
||||
LOG_PRINT_L1(w->get()->get_log_prefix() + " PoS mint iteration finished(" << ctx.rsp.status << ")");
|
||||
LOG_PRINT_L1(w->get()->get_log_prefix() + " PoS mint iteration finished(iterations: " << ctx.rsp.iterations_processed << "," << ctx.rsp.status << ")");
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1084,6 +1084,7 @@ namespace currency
|
|||
uint64_t starter_timestamp;
|
||||
crypto::hash last_block_hash;
|
||||
bool is_pos_allowed;
|
||||
uint64_t iterations_processed;
|
||||
|
||||
BEGIN_KV_SERIALIZE_MAP()
|
||||
KV_SERIALIZE(status)
|
||||
|
|
@ -1091,6 +1092,7 @@ namespace currency
|
|||
KV_SERIALIZE(block_timestamp)
|
||||
KV_SERIALIZE(height)
|
||||
KV_SERIALIZE(is_pos_allowed)
|
||||
KV_SERIALIZE(iterations_processed)
|
||||
KV_SERIALIZE(starter_timestamp)
|
||||
KV_SERIALIZE_VAL_POD_AS_BLOB(last_block_hash);
|
||||
END_KV_SERIALIZE_MAP()
|
||||
|
|
|
|||
|
|
@ -1014,7 +1014,7 @@ namespace tools
|
|||
cxt.rsp.status = CORE_RPC_STATUS_NOT_FOUND;
|
||||
uint64_t timstamp_start = runtime_config.get_core_time();
|
||||
uint64_t timstamp_last_idle_call = runtime_config.get_core_time();
|
||||
|
||||
cxt.rsp.iterations_processed = 0;
|
||||
|
||||
for (size_t i = 0; i != cxt.sp.pos_entries.size(); i++)
|
||||
{
|
||||
|
|
@ -1080,6 +1080,7 @@ namespace tools
|
|||
{
|
||||
PROFILE_FUNC("check_hash");
|
||||
check_hash_res = currency::check_hash(kernel_hash, this_coin_diff);
|
||||
++cxt.rsp.iterations_processed;
|
||||
}
|
||||
if (check_hash_res)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue