Compare commits
1 commit
dev
...
mark_unmix
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
314d42611d |
3 changed files with 151 additions and 83 deletions
|
|
@ -304,6 +304,10 @@ bool blockchain_storage::init(const std::string& config_folder, const boost::pro
|
||||||
if(!m_db_blocks.back()->bl.timestamp)
|
if(!m_db_blocks.back()->bl.timestamp)
|
||||||
timestamp_diff = m_core_runtime_config.get_core_time() - 1341378000;
|
timestamp_diff = m_core_runtime_config.get_core_time() - 1341378000;
|
||||||
|
|
||||||
|
m_db.begin_transaction();
|
||||||
|
set_lost_tx_unmixable();
|
||||||
|
m_db.commit_transaction();
|
||||||
|
|
||||||
LOG_PRINT_GREEN("Blockchain initialized. (v:" << m_db_storage_major_compatibility_version << ") last block: " << m_db_blocks.size() - 1 << ENDL
|
LOG_PRINT_GREEN("Blockchain initialized. (v:" << m_db_storage_major_compatibility_version << ") last block: " << m_db_blocks.size() - 1 << ENDL
|
||||||
<< "genesis: " << get_block_hash(m_db_blocks[0]->bl) << ENDL
|
<< "genesis: " << get_block_hash(m_db_blocks[0]->bl) << ENDL
|
||||||
<< "last block: " << m_db_blocks.size() - 1 << ", " << misc_utils::get_time_interval_string(timestamp_diff) << " time ago" << ENDL
|
<< "last block: " << m_db_blocks.size() - 1 << ", " << misc_utils::get_time_interval_string(timestamp_diff) << " time ago" << ENDL
|
||||||
|
|
@ -311,10 +315,49 @@ bool blockchain_storage::init(const std::string& config_folder, const boost::pro
|
||||||
<< "current pow difficulty: " << get_next_diff_conditional(false) << ENDL
|
<< "current pow difficulty: " << get_next_diff_conditional(false) << ENDL
|
||||||
<< "total transactions: " << m_db_transactions.size(),
|
<< "total transactions: " << m_db_transactions.size(),
|
||||||
LOG_LEVEL_0);
|
LOG_LEVEL_0);
|
||||||
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//------------------------------------------------------------------
|
||||||
|
bool blockchain_storage::set_lost_tx_unmixable_for_height(uint64_t height)
|
||||||
|
{
|
||||||
|
if (height == 75738)
|
||||||
|
return set_lost_tx_unmixable();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
//------------------------------------------------------------------
|
||||||
|
bool blockchain_storage::set_lost_tx_unmixable()
|
||||||
|
{
|
||||||
|
if (m_db_blocks.size() > 75738)
|
||||||
|
{
|
||||||
|
crypto::hash tx_id_1 = epee::string_tools::parse_tpod_from_hex_string<crypto::hash>("c2a2229d614e7c026433efbcfdbd0be1f68d9b419220336df3e2c209f5d57314");
|
||||||
|
crypto::hash tx_id_2 = epee::string_tools::parse_tpod_from_hex_string<crypto::hash>("647f936c6ffbd136f5c95d9a90ad554bdb4c01541c6eb5755ad40b984d80da67");
|
||||||
|
|
||||||
|
auto tx_ptr_1 = m_db_transactions.find(tx_id_1);
|
||||||
|
CHECK_AND_ASSERT_MES(tx_ptr_1, false, "Internal error: filed to find lost tx");
|
||||||
|
transaction_chain_entry tx1_local_entry(*tx_ptr_1);
|
||||||
|
for (size_t i = 0; i != tx1_local_entry.m_spent_flags.size(); i++)
|
||||||
|
{
|
||||||
|
tx1_local_entry.m_spent_flags[i] = true;
|
||||||
|
}
|
||||||
|
m_db_transactions.set(tx_id_1, tx1_local_entry);
|
||||||
|
|
||||||
|
auto tx_ptr_2 = m_db_transactions.find(tx_id_2);
|
||||||
|
transaction_chain_entry tx2_local_entry(*tx_ptr_2);
|
||||||
|
CHECK_AND_ASSERT_MES(tx_ptr_1, false, "Internal error: filed to find lost tx");
|
||||||
|
for (size_t i = 0; i != tx2_local_entry.m_spent_flags.size(); i++)
|
||||||
|
{
|
||||||
|
tx2_local_entry.m_spent_flags[i] = true;
|
||||||
|
}
|
||||||
|
m_db_transactions.set(tx_id_2, tx2_local_entry);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
//------------------------------------------------------------------
|
||||||
|
void blockchain_storage::patch_out_if_needed(txout_to_key& out, const crypto::hash& tx_id, uint64_t n) const
|
||||||
|
{
|
||||||
|
}
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
void blockchain_storage::initialize_db_solo_options_values()
|
void blockchain_storage::initialize_db_solo_options_values()
|
||||||
{
|
{
|
||||||
|
|
@ -1578,7 +1621,19 @@ bool blockchain_storage::handle_alternative_block(const block& b, const crypto::
|
||||||
{
|
{
|
||||||
//block orphaned
|
//block orphaned
|
||||||
bvc.m_marked_as_orphaned = true;
|
bvc.m_marked_as_orphaned = true;
|
||||||
LOG_PRINT_RED_L0("Block recognized as orphaned and rejected, id = " << id << "," << ENDL << "parent id = " << b.prev_id << ENDL << "height = " << coinbase_height);
|
|
||||||
|
if (m_invalid_blocks.count(id) != 0)
|
||||||
|
{
|
||||||
|
LOG_PRINT_RED_L0("Block recognized as blacklisted (parent " << b.prev_id << " is in blacklist) and rejected, id = " << id << "," << ENDL << "parent id = " << b.prev_id << ENDL << "height = " << coinbase_height);
|
||||||
|
}
|
||||||
|
else if (m_invalid_blocks.count(b.prev_id) != 0)
|
||||||
|
{
|
||||||
|
LOG_PRINT_RED_L0("Block recognized as orphaned (parent " << b.prev_id << " is in blacklist) and rejected, id = " << id << "," << ENDL << "parent id = " << b.prev_id << ENDL << "height = " << coinbase_height);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LOG_PRINT_RED_L0("Block recognized as orphaned and rejected, id = " << id << "," << ENDL << "parent id = " << b.prev_id << ENDL << "height = " << coinbase_height);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CHECK_AND_ASSERT_MES(validate_blockchain_prev_links(), false, "EPIC FAIL!");
|
CHECK_AND_ASSERT_MES(validate_blockchain_prev_links(), false, "EPIC FAIL!");
|
||||||
|
|
@ -3458,10 +3513,11 @@ bool blockchain_storage::print_tx_outputs_lookup(const crypto::hash& tx_id)const
|
||||||
|
|
||||||
//amount -> index -> [{tx_id, rind_count}]
|
//amount -> index -> [{tx_id, rind_count}]
|
||||||
std::map<uint64_t, std::map<uint64_t, std::list<std::pair<crypto::hash,uint64_t > > > > usage_stat;
|
std::map<uint64_t, std::map<uint64_t, std::list<std::pair<crypto::hash,uint64_t > > > > usage_stat;
|
||||||
|
std::stringstream strm_tx;
|
||||||
CHECK_AND_ASSERT_MES(tx_ptr->tx.vout.size() == tx_ptr->m_global_output_indexes.size(), false, "Internal error: output size missmatch");
|
CHECK_AND_ASSERT_MES(tx_ptr->tx.vout.size() == tx_ptr->m_global_output_indexes.size(), false, "Internal error: output size missmatch");
|
||||||
for (uint64_t i = 0; i!= tx_ptr->tx.vout.size();i++)
|
for (uint64_t i = 0; i!= tx_ptr->tx.vout.size();i++)
|
||||||
{
|
{
|
||||||
|
strm_tx << "[" << i << "]: " << print_money(tx_ptr->tx.vout[i].amount) << ENDL;
|
||||||
if (tx_ptr->tx.vout[i].target.type() != typeid(currency::txout_to_key))
|
if (tx_ptr->tx.vout[i].target.type() != typeid(currency::txout_to_key))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
@ -3513,7 +3569,7 @@ bool blockchain_storage::print_tx_outputs_lookup(const crypto::hash& tx_id)const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_PRINT_L0("Results: " << ENDL << ss.str());
|
LOG_PRINT_L0("Results: " << ENDL << strm_tx.str() << ENDL << ss.str());
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -4619,6 +4675,10 @@ bool blockchain_storage::handle_block_to_main_chain(const block& bl, const crypt
|
||||||
powpos_str_entry << "PoW:\t" << proof_hash;
|
powpos_str_entry << "PoW:\t" << proof_hash;
|
||||||
timestamp_str_entry << ", block ts: " << bei.bl.timestamp << " (diff: " << std::showpos << ts_diff << "s)";
|
timestamp_str_entry << ", block ts: " << bei.bl.timestamp << " (diff: " << std::showpos << ts_diff << "s)";
|
||||||
}
|
}
|
||||||
|
//explanation of this code will be provided later with public announce
|
||||||
|
set_lost_tx_unmixable_for_height(bei.height);
|
||||||
|
|
||||||
|
|
||||||
LOG_PRINT_L1("+++++ BLOCK SUCCESSFULLY ADDED " << (is_pos_bl ? "[PoS]" : "[PoW]") << " Sq: " << sequence_factor
|
LOG_PRINT_L1("+++++ BLOCK SUCCESSFULLY ADDED " << (is_pos_bl ? "[PoS]" : "[PoW]") << " Sq: " << sequence_factor
|
||||||
<< ENDL << "id:\t" << id << timestamp_str_entry.str()
|
<< ENDL << "id:\t" << id << timestamp_str_entry.str()
|
||||||
<< ENDL << powpos_str_entry.str()
|
<< ENDL << powpos_str_entry.str()
|
||||||
|
|
|
||||||
|
|
@ -525,6 +525,9 @@ namespace currency
|
||||||
bool init_tx_fee_median();
|
bool init_tx_fee_median();
|
||||||
bool update_tx_fee_median();
|
bool update_tx_fee_median();
|
||||||
void initialize_db_solo_options_values();
|
void initialize_db_solo_options_values();
|
||||||
|
bool set_lost_tx_unmixable();
|
||||||
|
bool set_lost_tx_unmixable_for_height(uint64_t height);
|
||||||
|
void patch_out_if_needed(txout_to_key& out, const crypto::hash& tx_id, uint64_t n)const ;
|
||||||
bool switch_to_alternative_blockchain(alt_chain_type& alt_chain);
|
bool switch_to_alternative_blockchain(alt_chain_type& alt_chain);
|
||||||
void purge_alt_block_txs_hashs(const block& b);
|
void purge_alt_block_txs_hashs(const block& b);
|
||||||
void add_alt_block_txs_hashs(const block& b);
|
void add_alt_block_txs_hashs(const block& b);
|
||||||
|
|
@ -691,7 +694,11 @@ namespace currency
|
||||||
TIME_MEASURE_FINISH_PD(tx_check_inputs_loop_scan_outputkeys_loop_find_tx);
|
TIME_MEASURE_FINISH_PD(tx_check_inputs_loop_scan_outputkeys_loop_find_tx);
|
||||||
|
|
||||||
CHECKED_GET_SPECIFIC_VARIANT(tx_ptr->tx.vout[n].target, const txout_to_key, outtk, false);
|
CHECKED_GET_SPECIFIC_VARIANT(tx_ptr->tx.vout[n].target, const txout_to_key, outtk, false);
|
||||||
|
//explanation of this code will be provided later with public announce
|
||||||
|
patch_out_if_needed(const_cast<txout_to_key&>(outtk), tx_id, n);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CHECK_AND_ASSERT_MES(tx_in_to_key.key_offsets.size() >= 1, false, "internal error: tx input has empty key_offsets"); // should never happen as input correctness must be handled by the caller
|
CHECK_AND_ASSERT_MES(tx_in_to_key.key_offsets.size() >= 1, false, "internal error: tx input has empty key_offsets"); // should never happen as input correctness must be handled by the caller
|
||||||
bool mixattr_ok = is_mixattr_applicable_for_fake_outs_counter(outtk.mix_attr, tx_in_to_key.key_offsets.size() - 1);
|
bool mixattr_ok = is_mixattr_applicable_for_fake_outs_counter(outtk.mix_attr, tx_in_to_key.key_offsets.size() - 1);
|
||||||
CHECK_AND_ASSERT_MES(mixattr_ok, false, "tx output #" << output_index << " violates mixin restrictions: mix_attr = " << static_cast<uint32_t>(outtk.mix_attr) << ", key_offsets.size = " << tx_in_to_key.key_offsets.size());
|
CHECK_AND_ASSERT_MES(mixattr_ok, false, "tx output #" << output_index << " violates mixin restrictions: mix_attr = " << static_cast<uint32_t>(outtk.mix_attr) << ", key_offsets.size = " << tx_in_to_key.key_offsets.size());
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ public:
|
||||||
//m_cmd_binder.set_handler("print_bci", boost::bind(&daemon_commands_handler::print_bci, this, _1));
|
//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_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_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_stat", boost::bind(&daemon_commands_handler::print_bc_outs_stat, 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", 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_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>");
|
m_cmd_binder.set_handler("print_tx", boost::bind(&daemon_commands_handler::print_tx, this, _1), "Print transaction, print_tx <transaction_hash>");
|
||||||
|
|
@ -85,17 +85,17 @@ public:
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|
||||||
// //--------------------------------------------------------------------------------
|
// //--------------------------------------------------------------------------------
|
||||||
// std::string get_commands_str()
|
// std::string get_commands_str()
|
||||||
// {
|
// {
|
||||||
// return m_cmd_binder.get_usage();
|
// return m_cmd_binder.get_usage();
|
||||||
// }
|
// }
|
||||||
// //--------------------------------------------------------------------------------
|
// //--------------------------------------------------------------------------------
|
||||||
// bool help(const std::vector<std::string>& /*args*/)
|
// bool help(const std::vector<std::string>& /*args*/)
|
||||||
// {
|
// {
|
||||||
// std::cout << get_commands_str() << ENDL;
|
// std::cout << get_commands_str() << ENDL;
|
||||||
// return true;
|
// return true;
|
||||||
// }
|
// }
|
||||||
//--------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------
|
||||||
bool print_pl(const std::vector<std::string>& args)
|
bool print_pl(const std::vector<std::string>& args)
|
||||||
{
|
{
|
||||||
|
|
@ -166,23 +166,24 @@ private:
|
||||||
{
|
{
|
||||||
m_srv.get_payload_object().get_core().get_blockchain_storage().reset_db_cache();
|
m_srv.get_payload_object().get_core().get_blockchain_storage().reset_db_cache();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
bool clear_altblocks(const std::vector<std::string>& args)
|
bool clear_altblocks(const std::vector<std::string>& args)
|
||||||
{
|
{
|
||||||
m_srv.get_payload_object().get_core().get_blockchain_storage().clear_altblocks();
|
m_srv.get_payload_object().get_core().get_blockchain_storage().clear_altblocks();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------
|
||||||
bool show_hr(const std::vector<std::string>& args)
|
bool show_hr(const std::vector<std::string>& args)
|
||||||
{
|
{
|
||||||
if(!m_srv.get_payload_object().get_core().get_miner().is_mining())
|
if (!m_srv.get_payload_object().get_core().get_miner().is_mining())
|
||||||
{
|
{
|
||||||
std::cout << "Mining is not started. You need start mining before you can see hash rate." << ENDL;
|
std::cout << "Mining is not started. You need start mining before you can see hash rate." << ENDL;
|
||||||
} else
|
}
|
||||||
{
|
else
|
||||||
m_srv.get_payload_object().get_core().get_miner().do_print_hashrate(true);
|
{
|
||||||
}
|
m_srv.get_payload_object().get_core().get_miner().do_print_hashrate(true);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
//--------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------
|
||||||
|
|
@ -194,7 +195,7 @@ private:
|
||||||
//--------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------
|
||||||
bool print_bc_outs(const std::vector<std::string>& args)
|
bool print_bc_outs(const std::vector<std::string>& args)
|
||||||
{
|
{
|
||||||
if(args.size() != 1)
|
if (args.size() != 1)
|
||||||
{
|
{
|
||||||
std::cout << "need file path as parameter" << ENDL;
|
std::cout << "need file path as parameter" << ENDL;
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -220,25 +221,25 @@ private:
|
||||||
//--------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------
|
||||||
bool print_cn(const std::vector<std::string>& args)
|
bool print_cn(const std::vector<std::string>& args)
|
||||||
{
|
{
|
||||||
m_srv.get_payload_object().log_connections();
|
m_srv.get_payload_object().log_connections();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
//--------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------
|
||||||
bool print_bc(const std::vector<std::string>& args)
|
bool print_bc(const std::vector<std::string>& args)
|
||||||
{
|
{
|
||||||
if(!args.size())
|
if (!args.size())
|
||||||
{
|
{
|
||||||
std::cout << "need block index parameter" << ENDL;
|
std::cout << "need block index parameter" << ENDL;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
uint64_t start_index = 0;
|
uint64_t start_index = 0;
|
||||||
uint64_t end_block_parametr = m_srv.get_payload_object().get_core().get_current_blockchain_size();
|
uint64_t end_block_parametr = m_srv.get_payload_object().get_core().get_current_blockchain_size();
|
||||||
if(!string_tools::get_xtype_from_string(start_index, args[0]))
|
if (!string_tools::get_xtype_from_string(start_index, args[0]))
|
||||||
{
|
{
|
||||||
std::cout << "wrong starter block index parameter" << ENDL;
|
std::cout << "wrong starter block index parameter" << ENDL;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if(args.size() >1 && !string_tools::get_xtype_from_string(end_block_parametr, args[1]))
|
if (args.size() > 1 && !string_tools::get_xtype_from_string(end_block_parametr, args[1]))
|
||||||
{
|
{
|
||||||
std::cout << "wrong end block index parameter" << ENDL;
|
std::cout << "wrong end block index parameter" << ENDL;
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -274,7 +275,7 @@ private:
|
||||||
{
|
{
|
||||||
m_srv.get_payload_object().get_core().get_blockchain_storage().print_db_cache_perfeormance_data();
|
m_srv.get_payload_object().get_core().get_blockchain_storage().print_db_cache_perfeormance_data();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
//--------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------
|
||||||
bool search_by_id(const std::vector<std::string>& args)
|
bool search_by_id(const std::vector<std::string>& args)
|
||||||
{
|
{
|
||||||
|
|
@ -287,7 +288,7 @@ private:
|
||||||
crypto::hash id = currency::null_hash;
|
crypto::hash id = currency::null_hash;
|
||||||
if (!parse_hash256(args[0], id))
|
if (!parse_hash256(args[0], id))
|
||||||
{
|
{
|
||||||
std::cout << "specified ID parameter '"<< args[0] << "' is wrong" << ENDL;
|
std::cout << "specified ID parameter '" << args[0] << "' is wrong" << ENDL;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
std::list<std::string> res_list;
|
std::list<std::string> res_list;
|
||||||
|
|
@ -373,7 +374,7 @@ private:
|
||||||
res = ::serialization::parse_binary(bin_buff, item);
|
res = ::serialization::parse_binary(bin_buff, item);
|
||||||
CHECK_AND_ASSERT_MES(res, false, "failed to parse binary");
|
CHECK_AND_ASSERT_MES(res, false, "failed to parse binary");
|
||||||
|
|
||||||
|
|
||||||
LOG_PRINT_L0("OBJECT " << typeid(item).name() << ": " << ENDL << obj_to_json_str(item));
|
LOG_PRINT_L0("OBJECT " << typeid(item).name() << ": " << ENDL << obj_to_json_str(item));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -416,43 +417,43 @@ private:
|
||||||
//--------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------
|
||||||
bool export_tx_pool_to_json(const std::vector<std::string>& args)
|
bool export_tx_pool_to_json(const std::vector<std::string>& args)
|
||||||
{
|
{
|
||||||
// if (!args.size())
|
// if (!args.size())
|
||||||
// {
|
// {
|
||||||
// std::cout << "need block blob parameter" << ENDL;
|
// std::cout << "need block blob parameter" << ENDL;
|
||||||
// return false;
|
// return false;
|
||||||
// }
|
// }
|
||||||
// tx_pool_exported_blobs tx_pool_json;
|
// tx_pool_exported_blobs tx_pool_json;
|
||||||
// m_srv.get_payload_object().get_core().get_tx_pool().get_all_transactions_details(tx_pool_json.all_txs_details);
|
// m_srv.get_payload_object().get_core().get_tx_pool().get_all_transactions_details(tx_pool_json.all_txs_details);
|
||||||
// std::string pool_state = epee::serialization::store_t_to_json(tx_pool_json);
|
// std::string pool_state = epee::serialization::store_t_to_json(tx_pool_json);
|
||||||
// CHECK_AND_ASSERT_THROW(pool_state.size(), false, "Unable to export pool");
|
// CHECK_AND_ASSERT_THROW(pool_state.size(), false, "Unable to export pool");
|
||||||
//
|
//
|
||||||
// bool r = file_io_utils::save_string_to_file(args[0], pool_state);
|
// bool r = file_io_utils::save_string_to_file(args[0], pool_state);
|
||||||
// CHECK_AND_ASSERT_THROW(r, false, "Unable to export pool");
|
// CHECK_AND_ASSERT_THROW(r, false, "Unable to export pool");
|
||||||
// LOG_PRINT_GREEN("Exported OK(" << tx_pool_json.all_txs_details.size() <<" transactions)");
|
// LOG_PRINT_GREEN("Exported OK(" << tx_pool_json.all_txs_details.size() <<" transactions)");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
//--------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------
|
||||||
bool import_tx_pool_to_json(const std::vector<std::string>& args)
|
bool import_tx_pool_to_json(const std::vector<std::string>& args)
|
||||||
{
|
{
|
||||||
// if (!args.size())
|
// if (!args.size())
|
||||||
// {
|
// {
|
||||||
// std::cout << "need block blob parameter" << ENDL;
|
// std::cout << "need block blob parameter" << ENDL;
|
||||||
// return false;
|
// return false;
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// std::string buff;
|
// std::string buff;
|
||||||
// bool r = file_io_utils::load_file_to_string(args[0], buff);
|
// bool r = file_io_utils::load_file_to_string(args[0], buff);
|
||||||
//
|
//
|
||||||
// tx_pool_exported_blobs tx_pool_json;
|
// tx_pool_exported_blobs tx_pool_json;
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
// m_srv.get_payload_object().get_core().get_tx_pool().get_all_transactions_details(tx_pool_json.all_txs_details);
|
// m_srv.get_payload_object().get_core().get_tx_pool().get_all_transactions_details(tx_pool_json.all_txs_details);
|
||||||
// std::string pool_state = epee::serialization::store_t_to_json(tx_pool_json);
|
// std::string pool_state = epee::serialization::store_t_to_json(tx_pool_json);
|
||||||
// CHECK_AND_ASSERT_THROW(pool_state.size(), false, "Unable to export pool");
|
// CHECK_AND_ASSERT_THROW(pool_state.size(), false, "Unable to export pool");
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
// CHECK_AND_ASSERT_THROW(r, false, "Unable to export pool");
|
// CHECK_AND_ASSERT_THROW(r, false, "Unable to export pool");
|
||||||
// LOG_PRINT_GREEN("Exported OK(" << tx_pool_json.all_txs_details.size() << " transactions)");
|
// LOG_PRINT_GREEN("Exported OK(" << tx_pool_json.all_txs_details.size() << " transactions)");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
//--------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------
|
||||||
|
|
@ -522,7 +523,7 @@ private:
|
||||||
if (r)
|
if (r)
|
||||||
{
|
{
|
||||||
// currency::block& block = bei.bl;
|
// currency::block& block = bei.bl;
|
||||||
LOG_PRINT_GREEN("------------------ block_id: " << bei.id << " ------------------" << ENDL << epee::serialization::store_t_to_json(bei) , LOG_LEVEL_0);
|
LOG_PRINT_GREEN("------------------ block_id: " << bei.id << " ------------------" << ENDL << epee::serialization::store_t_to_json(bei), LOG_LEVEL_0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -551,7 +552,7 @@ private:
|
||||||
|
|
||||||
if (r)
|
if (r)
|
||||||
{
|
{
|
||||||
// currency::block& block = bei.bl;
|
// currency::block& block = bei.bl;
|
||||||
LOG_PRINT_GREEN("------------------ block_id: " << get_block_hash(bei.bl) << " ------------------" << ENDL << currency::obj_to_json_str(bei), LOG_LEVEL_0);
|
LOG_PRINT_GREEN("------------------ block_id: " << get_block_hash(bei.bl) << " ------------------" << ENDL << currency::obj_to_json_str(bei), LOG_LEVEL_0);
|
||||||
m_srv.get_payload_object().get_core().get_blockchain_storage().calc_tx_cummulative_blob(bei.bl);
|
m_srv.get_payload_object().get_core().get_blockchain_storage().calc_tx_cummulative_blob(bei.bl);
|
||||||
}
|
}
|
||||||
|
|
@ -623,11 +624,11 @@ private:
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// std::vector<crypto::hash> tx_ids;
|
// std::vector<crypto::hash> tx_ids;
|
||||||
// tx_ids.push_back(tx_hash);
|
// tx_ids.push_back(tx_hash);
|
||||||
// std::list<currency::transaction> txs;
|
// std::list<currency::transaction> txs;
|
||||||
// std::list<crypto::hash> missed_ids;
|
// std::list<crypto::hash> missed_ids;
|
||||||
// m_srv.get_payload_object().get_core().get_transactions(tx_ids, txs, missed_ids);
|
// m_srv.get_payload_object().get_core().get_transactions(tx_ids, txs, missed_ids);
|
||||||
|
|
||||||
currency::transaction_chain_entry tx_entry = AUTO_VAL_INIT(tx_entry);
|
currency::transaction_chain_entry tx_entry = AUTO_VAL_INIT(tx_entry);
|
||||||
|
|
||||||
|
|
@ -655,10 +656,10 @@ private:
|
||||||
for (auto at : tx.attachment)
|
for (auto at : tx.attachment)
|
||||||
{
|
{
|
||||||
if (at.type() == typeid(currency::tx_service_attachment))
|
if (at.type() == typeid(currency::tx_service_attachment))
|
||||||
{
|
{
|
||||||
const currency::tx_service_attachment& sa = boost::get<currency::tx_service_attachment>(at);
|
const currency::tx_service_attachment& sa = boost::get<currency::tx_service_attachment>(at);
|
||||||
ss << "++++++++++++++++++++++++++++++++ " << ENDL;
|
ss << "++++++++++++++++++++++++++++++++ " << ENDL;
|
||||||
ss << "[SERVICE_ATTACHMENT]: ID = \'" << sa.service_id << "\', INSTRUCTION: \'" << sa.instruction << "\'" << ENDL;
|
ss << "[SERVICE_ATTACHMENT]: ID = \'" << sa.service_id << "\', INSTRUCTION: \'" << sa.instruction << "\'" << ENDL;
|
||||||
|
|
||||||
if (!(sa.flags&TX_SERVICE_ATTACHMENT_ENCRYPT_BODY))
|
if (!(sa.flags&TX_SERVICE_ATTACHMENT_ENCRYPT_BODY))
|
||||||
{
|
{
|
||||||
|
|
@ -696,7 +697,7 @@ private:
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------
|
||||||
bool print_pool(const std::vector<std::string>& args)
|
bool print_pool(const std::vector<std::string>& args)
|
||||||
{
|
{
|
||||||
|
|
@ -711,20 +712,20 @@ private:
|
||||||
} //--------------------------------------------------------------------------------
|
} //--------------------------------------------------------------------------------
|
||||||
bool start_mining(const std::vector<std::string>& args)
|
bool start_mining(const std::vector<std::string>& args)
|
||||||
{
|
{
|
||||||
if(!args.size())
|
if (!args.size())
|
||||||
{
|
{
|
||||||
std::cout << "Please, specify wallet address to mine for: start_mining <addr> [threads=1]" << std::endl;
|
std::cout << "Please, specify wallet address to mine for: start_mining <addr> [threads=1]" << std::endl;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
currency::account_public_address adr;
|
currency::account_public_address adr;
|
||||||
if(!currency::get_account_address_from_str(adr, args.front()))
|
if (!currency::get_account_address_from_str(adr, args.front()))
|
||||||
{
|
{
|
||||||
std::cout << "target account address has wrong format" << std::endl;
|
std::cout << "target account address has wrong format" << std::endl;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
size_t threads_count = 1;
|
size_t threads_count = 1;
|
||||||
if(args.size() > 1)
|
if (args.size() > 1)
|
||||||
{
|
{
|
||||||
bool ok = string_tools::get_xtype_from_string(threads_count, args[1]);
|
bool ok = string_tools::get_xtype_from_string(threads_count, args[1]);
|
||||||
threads_count = (ok && 0 < threads_count) ? threads_count : 1;
|
threads_count = (ok && 0 < threads_count) ? threads_count : 1;
|
||||||
|
|
@ -771,7 +772,7 @@ private:
|
||||||
else
|
else
|
||||||
ss << " ";
|
ss << " ";
|
||||||
ss << std::setw(10) << std::left << pow_diffs[i].second;
|
ss << std::setw(10) << std::left << pow_diffs[i].second;
|
||||||
|
|
||||||
ss << " ";
|
ss << " ";
|
||||||
ss << std::setw(6) << std::left << pos_diffs[i].first;
|
ss << std::setw(6) << std::left << pos_diffs[i].first;
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
|
|
@ -791,9 +792,9 @@ private:
|
||||||
LOG_PRINT_L0(ENDL << epee::deadlock_guard_singleton::get_dlg_state());
|
LOG_PRINT_L0(ENDL << epee::deadlock_guard_singleton::get_dlg_state());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
POP_WARNINGS
|
POP_WARNINGS
|
||||||
Loading…
Add table
Reference in a new issue