forked from lthn/blockchain
Merge branch 'master' into frontend
This commit is contained in:
commit
291763d727
15 changed files with 90 additions and 79 deletions
|
|
@ -78,7 +78,7 @@ namespace epee
|
|||
{
|
||||
|
||||
t_object t;
|
||||
std::recursive_mutex m;
|
||||
mutable std::recursive_mutex m;
|
||||
template<typename t_proxy_object, typename t_proxy_lock_time_watching_policy>
|
||||
friend class locked_object_proxy;
|
||||
public:
|
||||
|
|
@ -106,6 +106,16 @@ namespace epee
|
|||
return locked_object_proxy<t_object, lock_time_watching_policy>(t, m);
|
||||
}
|
||||
|
||||
locked_object_proxy<const t_object, lock_time_watching_policy> operator->() const
|
||||
{
|
||||
return locked_object_proxy<const t_object, lock_time_watching_policy>(t, m);
|
||||
}
|
||||
|
||||
locked_object_proxy<const t_object, lock_time_watching_policy> operator*() const
|
||||
{
|
||||
return locked_object_proxy<const t_object, lock_time_watching_policy>(t, m);
|
||||
}
|
||||
|
||||
/*locked_object_proxy<t_object> operator()()
|
||||
{
|
||||
return locked_object_proxy<t_object>(t, m);
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@ namespace currency
|
|||
return true;
|
||||
}
|
||||
//-----------------------------------------------------------------
|
||||
std::string account_base::get_public_address_str()
|
||||
std::string account_base::get_public_address_str() const
|
||||
{
|
||||
//TODO: change this code into base 58
|
||||
return get_account_address_as_str(m_keys.m_account_address);
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ namespace currency
|
|||
void generate();
|
||||
const account_keys& get_keys() const;
|
||||
const account_public_address& get_public_address() const { return m_keys.m_account_address; };
|
||||
std::string get_public_address_str();
|
||||
std::string get_public_address_str() const;
|
||||
std::string get_restore_data() const;
|
||||
std::string get_restore_braindata() const;
|
||||
|
||||
|
|
|
|||
|
|
@ -145,9 +145,10 @@ namespace currency
|
|||
//check key images for transaction if it is not kept by block
|
||||
if(!from_core && !kept_by_block)
|
||||
{
|
||||
if(have_tx_keyimges_as_spent(tx))
|
||||
crypto::key_image spent_ki = AUTO_VAL_INIT(spent_ki);
|
||||
if(have_tx_keyimges_as_spent(tx, &spent_ki))
|
||||
{
|
||||
LOG_ERROR("Transaction with id= "<< id << " used already spent key images");
|
||||
LOG_ERROR("Transaction " << id << " uses already spent key image " << spent_ki);
|
||||
tvc.m_verification_failed = true;
|
||||
return false;
|
||||
}
|
||||
|
|
@ -735,15 +736,19 @@ namespace currency
|
|||
return false;
|
||||
}
|
||||
//---------------------------------------------------------------------------------
|
||||
bool tx_memory_pool::have_tx_keyimges_as_spent(const transaction& tx) const
|
||||
bool tx_memory_pool::have_tx_keyimges_as_spent(const transaction& tx, crypto::key_image* p_spent_ki /* = nullptr */) const
|
||||
{
|
||||
for(const auto& in : tx.vin)
|
||||
{
|
||||
if (in.type() == typeid(txin_to_key))
|
||||
{
|
||||
CHECKED_GET_SPECIFIC_VARIANT(in, const txin_to_key, tokey_in, true);//should never fail
|
||||
if(have_tx_keyimg_as_spent(tokey_in.k_image))
|
||||
return true;
|
||||
if (have_tx_keyimg_as_spent(tokey_in.k_image))
|
||||
{
|
||||
if (p_spent_ki)
|
||||
*p_spent_ki = tokey_in.k_image;
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -761,8 +766,10 @@ namespace currency
|
|||
auto ki_entry_ptr = m_db_key_images_set.get(tokey_in.k_image);
|
||||
if (ki_entry_ptr.get())
|
||||
count = *ki_entry_ptr;
|
||||
uint64_t count_before = count;
|
||||
++count;
|
||||
m_db_key_images_set.set(tokey_in.k_image, count);
|
||||
LOG_PRINT_L2("tx pool: key image added: " << tokey_in.k_image << ", from tx " << get_transaction_hash(tx) << ", counter: " << count_before << " -> " << count);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
|
@ -828,11 +835,13 @@ namespace currency
|
|||
continue;
|
||||
}
|
||||
count = *ki_entry_ptr;
|
||||
uint64_t count_before = count;
|
||||
--count;
|
||||
if (count)
|
||||
m_db_key_images_set.set(tokey_in.k_image, count);
|
||||
else
|
||||
m_db_key_images_set.erase(tokey_in.k_image);
|
||||
LOG_PRINT_L2("tx pool: key image removed: " << tokey_in.k_image << ", from tx " << get_transaction_hash(tx) << ", counter: " << count_before << " -> " << count);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ namespace currency
|
|||
|
||||
bool have_tx(const crypto::hash &id)const;
|
||||
bool have_tx_keyimg_as_spent(const crypto::key_image& key_im)const;
|
||||
bool have_tx_keyimges_as_spent(const transaction& tx)const;
|
||||
bool have_tx_keyimges_as_spent(const transaction& tx, crypto::key_image* p_spent_ki = nullptr) const;
|
||||
const performnce_data& get_performnce_data() const { return m_performance_data; }
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -204,8 +204,7 @@ bool daemon_backend::init(int argc, char* argv[], view::i_view* pview_handler)
|
|||
|
||||
if (command_line::has_arg(m_vm, arg_remote_node))
|
||||
{
|
||||
bool r = configure_for_remote_node(command_line::get_arg(m_vm, arg_remote_node));
|
||||
CHECK_AND_ASSERT_MES(r, false, "Failed to configure_for_remote_node");
|
||||
// configure for remote node
|
||||
}
|
||||
|
||||
m_pview->init(path_to_html);
|
||||
|
|
@ -222,18 +221,6 @@ bool daemon_backend::init(int argc, char* argv[], view::i_view* pview_handler)
|
|||
CATCH_ENTRY_L0("init", false);
|
||||
}
|
||||
|
||||
bool daemon_backend::configure_for_remote_node(const std::string& remote_host)
|
||||
{
|
||||
//parse node
|
||||
tools::default_http_core_proxy* proxy = new tools::default_http_core_proxy();
|
||||
m_rpc_proxy.reset(proxy);
|
||||
bool r = proxy->set_connection_addr(remote_host);
|
||||
CHECK_AND_ASSERT_MES(r, false, "Failed to assign remote node address");
|
||||
proxy->set_plast_daemon_is_disconnected(&m_last_daemon_is_disconnected);
|
||||
m_remote_node_mode = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool daemon_backend::start()
|
||||
{
|
||||
TRY_ENTRY();
|
||||
|
|
@ -618,7 +605,7 @@ std::string daemon_backend::get_my_offers(const bc_services::core_offers_filter&
|
|||
size_t offers_added = offers_count_after - offers_count_before;
|
||||
if (offers_added > 0)
|
||||
{
|
||||
LOG_PRINT("get_my_offers(): " << offers_added << " offers added from wallet " << wallet_title, LOG_LEVEL_2);
|
||||
LOG_PRINT(get_wallet_log_prefix(w.second.wallet_id) + "get_my_offers(): " << offers_added << " offers added from wallet " << wallet_title, LOG_LEVEL_2);
|
||||
}
|
||||
|
||||
++wallet_index;
|
||||
|
|
@ -948,14 +935,14 @@ std::string daemon_backend::request_alias_registration(const currency::alias_rpc
|
|||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
LOG_ERROR("request_alias_registration error: " << e.what());
|
||||
LOG_ERROR(get_wallet_log_prefix(wallet_id) + "request_alias_registration error: " << e.what());
|
||||
std::string err_code = API_RETURN_CODE_INTERNAL_ERROR;
|
||||
err_code += std::string(":") + e.what();
|
||||
return err_code;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
LOG_ERROR("request_alias_registration error: unknown error");
|
||||
LOG_ERROR(get_wallet_log_prefix(wallet_id) + "request_alias_registration error: unknown error");
|
||||
return API_RETURN_CODE_INTERNAL_ERROR;
|
||||
}
|
||||
}
|
||||
|
|
@ -987,14 +974,14 @@ std::string daemon_backend::request_alias_update(const currency::alias_rpc_detai
|
|||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
LOG_ERROR("request_alias_update error: " << e.what());
|
||||
LOG_ERROR(get_wallet_log_prefix(wallet_id) + "request_alias_update error: " << e.what());
|
||||
std::string err_code = API_RETURN_CODE_INTERNAL_ERROR;
|
||||
err_code += std::string(":") + e.what();
|
||||
return err_code;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
LOG_ERROR("request_alias_update error: unknown error");
|
||||
LOG_ERROR(get_wallet_log_prefix(wallet_id) + "request_alias_update error: unknown error");
|
||||
return API_RETURN_CODE_INTERNAL_ERROR;
|
||||
}
|
||||
}
|
||||
|
|
@ -1094,14 +1081,14 @@ std::string daemon_backend::transfer(size_t wallet_id, const view::transfer_para
|
|||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
LOG_ERROR("Transfer error: " << e.what());
|
||||
LOG_ERROR(get_wallet_log_prefix(wallet_id) + "Transfer error: " << e.what());
|
||||
std::string err_code = API_RETURN_CODE_INTERNAL_ERROR;
|
||||
err_code += std::string(":") + e.what();
|
||||
return err_code;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
LOG_ERROR("Transfer error: unknown error");
|
||||
LOG_ERROR(get_wallet_log_prefix(wallet_id) + "Transfer error: unknown error");
|
||||
return API_RETURN_CODE_INTERNAL_ERROR;
|
||||
}
|
||||
|
||||
|
|
@ -1156,20 +1143,20 @@ std::string daemon_backend::create_proposal(size_t wallet_id,
|
|||
}
|
||||
catch (const tools::error::not_enough_money& e)
|
||||
{
|
||||
LOG_ERROR("send_escrow_proposal error: API_RETURN_CODE_NOT_ENOUGH_MONEY: " << e.what());
|
||||
LOG_ERROR(get_wallet_log_prefix(wallet_id) + "send_escrow_proposal error: API_RETURN_CODE_NOT_ENOUGH_MONEY: " << e.what());
|
||||
std::string err_code = API_RETURN_CODE_NOT_ENOUGH_MONEY;
|
||||
return err_code;
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
LOG_ERROR("send_escrow_proposal error: " << e.what());
|
||||
LOG_ERROR(get_wallet_log_prefix(wallet_id) + "send_escrow_proposal error: " << e.what());
|
||||
std::string err_code = API_RETURN_CODE_INTERNAL_ERROR;
|
||||
err_code += std::string(":") + e.what();
|
||||
return err_code;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
LOG_ERROR("send_escrow_proposal error: unknown error");
|
||||
LOG_ERROR(get_wallet_log_prefix(wallet_id) + "send_escrow_proposal error: unknown error");
|
||||
return API_RETURN_CODE_INTERNAL_ERROR;
|
||||
}
|
||||
}
|
||||
|
|
@ -1225,7 +1212,7 @@ std::string daemon_backend::accept_cancel_contract(size_t wallet_id, const crypt
|
|||
//TODO: add some
|
||||
TIME_MEASURE_FINISH_MS(timing1);
|
||||
if (timing1 > 500)
|
||||
LOG_PRINT_RED_L0("[daemon_backend::accept_cancel_contract] LOW PERFORMANCE: " << timing1 );
|
||||
LOG_PRINT_RED_L0(get_wallet_log_prefix(wallet_id) + "[daemon_backend::accept_cancel_contract] LOW PERFORMANCE: " << timing1 );
|
||||
|
||||
return API_RETURN_CODE_OK;
|
||||
}
|
||||
|
|
@ -1344,14 +1331,14 @@ std::string daemon_backend::push_offer(size_t wallet_id, const bc_services::offe
|
|||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
LOG_ERROR("push_offer error: " << e.what());
|
||||
LOG_ERROR(get_wallet_log_prefix(wallet_id) + "push_offer error: " << e.what());
|
||||
std::string err_code = API_RETURN_CODE_INTERNAL_ERROR;
|
||||
err_code += std::string(":") + e.what();
|
||||
return err_code;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
LOG_ERROR("push_offer error: unknown error");
|
||||
LOG_ERROR(get_wallet_log_prefix(wallet_id) + "push_offer error: unknown error");
|
||||
return API_RETURN_CODE_INTERNAL_ERROR;
|
||||
}
|
||||
}
|
||||
|
|
@ -1365,14 +1352,14 @@ std::string daemon_backend::cancel_offer(const view::cancel_offer_param& co, cur
|
|||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
LOG_ERROR("cancel_offer error: " << e.what());
|
||||
LOG_ERROR(get_wallet_log_prefix(co.wallet_id) + "cancel_offer error: " << e.what());
|
||||
std::string err_code = API_RETURN_CODE_INTERNAL_ERROR;
|
||||
err_code += std::string(":") + e.what();
|
||||
return err_code;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
LOG_ERROR("cancel_offer error: unknown error");
|
||||
LOG_ERROR(get_wallet_log_prefix(co.wallet_id) + "cancel_offer error: unknown error");
|
||||
return API_RETURN_CODE_INTERNAL_ERROR;
|
||||
}
|
||||
}
|
||||
|
|
@ -1388,14 +1375,14 @@ std::string daemon_backend::push_update_offer(const bc_services::update_offer_de
|
|||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
LOG_ERROR("cancel_offer error: " << e.what());
|
||||
LOG_ERROR(get_wallet_log_prefix(uo.wallet_id) + "push_update_offer error: " << e.what());
|
||||
std::string err_code = API_RETURN_CODE_INTERNAL_ERROR;
|
||||
err_code += std::string(":") + e.what();
|
||||
return err_code;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
LOG_ERROR("cancel_offer error: unknown error");
|
||||
LOG_ERROR(get_wallet_log_prefix(uo.wallet_id) + "push_update_offer error: unknown error");
|
||||
return API_RETURN_CODE_INTERNAL_ERROR;
|
||||
}
|
||||
}
|
||||
|
|
@ -1468,7 +1455,7 @@ void daemon_backend::on_transfer_canceled(size_t wallet_id, const tools::wallet_
|
|||
}
|
||||
else
|
||||
{
|
||||
LOG_ERROR("on_transfer() wallet with id = " << wallet_id << " not found");
|
||||
LOG_ERROR(get_wallet_log_prefix(wallet_id) + "on_transfer() wallet with id = " << wallet_id << " not found");
|
||||
}
|
||||
m_pview->money_transfer_cancel(tei);
|
||||
}
|
||||
|
|
@ -1546,10 +1533,10 @@ void daemon_backend::wallet_vs_options::worker_func()
|
|||
{
|
||||
pos_minin_interval.do_call([this](){
|
||||
tools::wallet2::mining_context ctx = AUTO_VAL_INIT(ctx);
|
||||
LOG_PRINT_L1("Starting PoS mint iteration");
|
||||
LOG_PRINT_L1(w->get()->get_log_prefix() + " Starting PoS mint iteration");
|
||||
if (!w->get()->fill_mining_context(ctx) || ctx.rsp.status != CORE_RPC_STATUS_OK)
|
||||
return true;
|
||||
LOG_PRINT_L1("POS_ENTRIES: " << ctx.sp.pos_entries.size());
|
||||
LOG_PRINT_L1(w->get()->get_log_prefix() + " POS_ENTRIES: " << ctx.sp.pos_entries.size());
|
||||
tools::wallet2::scan_pos(ctx, break_mining_loop, [this](){
|
||||
return *plast_daemon_network_state == currency::COMMAND_RPC_GET_INFO::daemon_network_state_online && *plast_daemon_height == last_wallet_synch_height;
|
||||
}, core_conf);
|
||||
|
|
@ -1558,7 +1545,7 @@ void daemon_backend::wallet_vs_options::worker_func()
|
|||
{
|
||||
w->get()->build_minted_block(ctx.sp, ctx.rsp);
|
||||
}
|
||||
LOG_PRINT_L1("PoS mint iteration finished(" << ctx.rsp.status << ")");
|
||||
LOG_PRINT_L1(w->get()->get_log_prefix() + " PoS mint iteration finished(" << ctx.rsp.status << ")");
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
|
@ -1577,7 +1564,7 @@ void daemon_backend::wallet_vs_options::worker_func()
|
|||
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
LOG_PRINT_L0("Failed to refresh wallet: " << e.what());
|
||||
LOG_PRINT_L0(w->get()->get_log_prefix() + "Failed to refresh wallet: " << e.what());
|
||||
wallet_state = wsi.wallet_state = view::wallet_status_info::wallet_state_error;
|
||||
pview->update_wallet_status(wsi);
|
||||
return;
|
||||
|
|
@ -1585,7 +1572,7 @@ void daemon_backend::wallet_vs_options::worker_func()
|
|||
|
||||
catch (...)
|
||||
{
|
||||
LOG_PRINT_L0("Failed to refresh wallet, unknownk exception");
|
||||
LOG_PRINT_L0(w->get()->get_log_prefix() + "Failed to refresh wallet, unknownk exception");
|
||||
wallet_state = wsi.wallet_state = view::wallet_status_info::wallet_state_error;
|
||||
pview->update_wallet_status(wsi);
|
||||
return;
|
||||
|
|
@ -1602,3 +1589,14 @@ daemon_backend::wallet_vs_options::~wallet_vs_options()
|
|||
if (miner_thread.joinable())
|
||||
miner_thread.join();
|
||||
}
|
||||
|
||||
std::string daemon_backend::get_wallet_log_prefix(size_t wallet_id) const
|
||||
{
|
||||
CRITICAL_REGION_LOCAL(m_wallets_lock);
|
||||
auto it = m_wallets.find(wallet_id);
|
||||
if (it == m_wallets.end())
|
||||
return std::string("[") + epee::string_tools::num_to_string_fast(wallet_id) + ":???]";
|
||||
|
||||
return std::string("[") + epee::string_tools::num_to_string_fast(wallet_id) + ":" + it->second.w->get()->get_account().get_public_address_str().substr(0, 6) + "]";
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -137,8 +137,8 @@ public:
|
|||
void subscribe_to_core_events(currency::i_core_event_handler* pevents_handler);
|
||||
void unsubscribe_to_core_events();
|
||||
void get_gui_options(view::gui_options& opt);
|
||||
bool is_remote_node_mode() { return m_remote_node_mode; }
|
||||
bool configure_for_remote_node(const std::string& remote_host);
|
||||
std::string get_wallet_log_prefix(size_t wallet_id) const;
|
||||
|
||||
private:
|
||||
void main_worker(const po::variables_map& vm);
|
||||
bool init_local_daemon();
|
||||
|
|
@ -163,7 +163,7 @@ private:
|
|||
view::i_view m_view_stub;
|
||||
view::i_view* m_pview;
|
||||
std::shared_ptr<tools::i_core_proxy> m_rpc_proxy;
|
||||
critical_section m_wallets_lock;
|
||||
mutable critical_section m_wallets_lock;
|
||||
po::variables_map m_vm;
|
||||
|
||||
std::atomic<uint64_t> m_last_daemon_height;
|
||||
|
|
|
|||
|
|
@ -542,7 +542,7 @@ bool MainWindow::init_backend(int argc, char* argv[])
|
|||
|
||||
QString MainWindow::is_remnotenode_mode_preconfigured()
|
||||
{
|
||||
return m_backend.is_remote_node_mode() ? "TRUE":"FALSE";
|
||||
return "FALSE";
|
||||
}
|
||||
|
||||
QString MainWindow::start_backend(const QString& params)
|
||||
|
|
@ -555,19 +555,6 @@ QString MainWindow::start_backend(const QString& params)
|
|||
ar.error_code = API_RETURN_CODE_BAD_ARG;
|
||||
return MAKE_RESPONSE(ar);
|
||||
}
|
||||
if (sbp.configure_for_remote_node)
|
||||
{
|
||||
//@#@
|
||||
sbp.remote_node_host = "88.198.50.112";
|
||||
sbp.remote_node_port = 11512;
|
||||
|
||||
bool r = m_backend.configure_for_remote_node(sbp.remote_node_host + ":" + std::to_string(sbp.remote_node_port));
|
||||
if (!r)
|
||||
{
|
||||
ar.error_code = API_RETURN_CODE_BAD_ARG;
|
||||
return MAKE_RESPONSE(ar);
|
||||
}
|
||||
}
|
||||
|
||||
bool r = m_backend.start();
|
||||
if (!r)
|
||||
|
|
@ -584,7 +571,7 @@ bool MainWindow::update_wallet_status(const view::wallet_status_info& wsi)
|
|||
m_wallet_states->operator [](wsi.wallet_id) = wsi.wallet_state;
|
||||
std::string json_str;
|
||||
epee::serialization::store_t_to_json(wsi, json_str);
|
||||
LOG_PRINT_L0("SENDING SIGNAL -> [update_wallet_status]:" << std::endl << json_str );
|
||||
LOG_PRINT_L0(get_wallet_log_prefix(wsi.wallet_id) + "SENDING SIGNAL -> [update_wallet_status]:" << std::endl << json_str );
|
||||
QMetaObject::invokeMethod(this, "update_wallet_status", Qt::QueuedConnection, Q_ARG(QString, json_str.c_str()));
|
||||
return true;
|
||||
}
|
||||
|
|
@ -627,7 +614,7 @@ bool MainWindow::money_transfer(const view::transfer_event_info& tei)
|
|||
std::string json_str;
|
||||
epee::serialization::store_t_to_json(tei, json_str);
|
||||
|
||||
LOG_PRINT_L0("SENDING SIGNAL -> [money_transfer]" << std::endl << json_str);
|
||||
LOG_PRINT_L0(get_wallet_log_prefix(tei.wallet_id) + "SENDING SIGNAL -> [money_transfer]" << std::endl << json_str);
|
||||
//this->money_transfer(json_str.c_str());
|
||||
QMetaObject::invokeMethod(this, "money_transfer", Qt::QueuedConnection, Q_ARG(QString, json_str.c_str()));
|
||||
if (!m_tray_icon)
|
||||
|
|
@ -670,7 +657,7 @@ bool MainWindow::money_transfer_cancel(const view::transfer_event_info& tei)
|
|||
std::string json_str;
|
||||
epee::serialization::store_t_to_json(tei, json_str);
|
||||
|
||||
LOG_PRINT_L0("SENDING SIGNAL -> [money_transfer_cancel]");
|
||||
LOG_PRINT_L0(get_wallet_log_prefix(tei.wallet_id) + "SENDING SIGNAL -> [money_transfer_cancel]");
|
||||
//this->money_transfer_cancel(json_str.c_str());
|
||||
QMetaObject::invokeMethod(this, "money_transfer_cancel", Qt::QueuedConnection, Q_ARG(QString, json_str.c_str()));
|
||||
|
||||
|
|
@ -679,7 +666,7 @@ bool MainWindow::money_transfer_cancel(const view::transfer_event_info& tei)
|
|||
}
|
||||
bool MainWindow::wallet_sync_progress(const view::wallet_sync_progres_param& p)
|
||||
{
|
||||
LOG_PRINT_L2("SENDING SIGNAL -> [wallet_sync_progress]" << " wallet_id: " << p.wallet_id << ": " << p.progress << "%");
|
||||
LOG_PRINT_L2(get_wallet_log_prefix(p.wallet_id) + "SENDING SIGNAL -> [wallet_sync_progress]" << " wallet_id: " << p.wallet_id << ": " << p.progress << "%");
|
||||
//this->wallet_sync_progress(epee::serialization::store_t_to_json(p).c_str());
|
||||
QMetaObject::invokeMethod(this, "wallet_sync_progress", Qt::QueuedConnection, Q_ARG(QString, epee::serialization::store_t_to_json(p).c_str()));
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -215,6 +215,7 @@ private:
|
|||
bool store_app_config();
|
||||
bool load_app_config();
|
||||
|
||||
std::string get_wallet_log_prefix(size_t wallet_id) const { return m_backend.get_wallet_log_prefix(wallet_id); }
|
||||
|
||||
|
||||
//MediatorObject mo;
|
||||
|
|
|
|||
|
|
@ -509,14 +509,8 @@ public:
|
|||
|
||||
struct start_backend_params
|
||||
{
|
||||
bool configure_for_remote_node;
|
||||
std::string remote_node_host;
|
||||
uint64_t remote_node_port;
|
||||
|
||||
BEGIN_KV_SERIALIZE_MAP()
|
||||
KV_SERIALIZE(configure_for_remote_node)
|
||||
KV_SERIALIZE(remote_node_host)
|
||||
KV_SERIALIZE(remote_node_port)
|
||||
END_KV_SERIALIZE_MAP()
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1757,6 +1757,11 @@ namespace
|
|||
}
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
void wallet2::init_log_prefix()
|
||||
{
|
||||
m_log_prefix = m_account.get_public_address_str().substr(0, 6);
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
void wallet2::load_keys(const std::string& buff, const std::string& password)
|
||||
{
|
||||
wallet2::keys_file_data keys_file_data;
|
||||
|
|
@ -1781,14 +1786,14 @@ void wallet2::load_keys(const std::string& buff, const std::string& password)
|
|||
WLT_LOG_L0("Wrong password for wallet " << string_encoding::convert_to_ansii(m_wallet_file));
|
||||
tools::error::throw_wallet_ex<error::invalid_password>(std::string(__FILE__ ":" STRINGIZE(__LINE__)));
|
||||
}
|
||||
|
||||
m_log_prefix = m_account.get_public_address_str().substr(0, 6);
|
||||
init_log_prefix();
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
void wallet2::assign_account(const currency::account_base& acc)
|
||||
{
|
||||
clear();
|
||||
m_account = acc;
|
||||
init_log_prefix();
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
void wallet2::generate(const std::wstring& path, const std::string& pass)
|
||||
|
|
@ -1797,6 +1802,7 @@ void wallet2::generate(const std::wstring& path, const std::string& pass)
|
|||
m_wallet_file = path;
|
||||
m_password = pass;
|
||||
m_account.generate();
|
||||
init_log_prefix();
|
||||
boost::system::error_code ignored_ec;
|
||||
THROW_IF_TRUE_WALLET_EX(boost::filesystem::exists(m_wallet_file, ignored_ec), error::file_exists, epee::string_encoding::convert_to_ansii(m_wallet_file));
|
||||
store();
|
||||
|
|
@ -1808,6 +1814,7 @@ void wallet2::restore(const std::wstring& path, const std::string& pass, const s
|
|||
m_wallet_file = path;
|
||||
m_password = pass;
|
||||
bool r = m_account.restore_keys_from_braindata(restore_key);
|
||||
init_log_prefix();
|
||||
THROW_IF_TRUE_WALLET_EX(!r, error::wallet_internal_error, epee::string_encoding::convert_to_ansii(m_wallet_file));
|
||||
boost::system::error_code ignored_ec;
|
||||
THROW_IF_TRUE_WALLET_EX(boost::filesystem::exists(m_wallet_file, ignored_ec), error::file_exists, epee::string_encoding::convert_to_ansii(m_wallet_file));
|
||||
|
|
|
|||
|
|
@ -255,7 +255,8 @@ namespace tools
|
|||
void store();
|
||||
void store(const std::wstring& path);
|
||||
std::wstring get_wallet_path(){ return m_wallet_file; }
|
||||
currency::account_base& get_account(){return m_account;}
|
||||
currency::account_base& get_account() { return m_account; }
|
||||
const currency::account_base& get_account() const { return m_account; }
|
||||
|
||||
void get_recent_transfers_history(std::vector<wallet_rpc::wallet_transfer_info>& trs, size_t offset, size_t count);
|
||||
uint64_t get_recent_transfers_total_count();
|
||||
|
|
@ -497,6 +498,8 @@ namespace tools
|
|||
std::vector<currency::tx_destination_entry>& prepared_destinations,
|
||||
crypto::hash multisig_id = currency::null_hash);
|
||||
|
||||
std::string get_log_prefix() const { return m_log_prefix; }
|
||||
|
||||
private:
|
||||
void add_transfers_to_expiration_list(const std::vector<uint64_t>& selected_transfers, uint64_t expiration, uint64_t change_amount, const crypto::hash& related_tx_id);
|
||||
void remove_transfer_from_expiration_list(uint64_t transfer_index);
|
||||
|
|
@ -596,6 +599,8 @@ private:
|
|||
void fill_transfer_details(const currency::transaction& tx, const tools::money_transfer2_details& td, tools::wallet_rpc::wallet_transfer_info_details& res_td) const;
|
||||
void print_source_entry(const currency::tx_source_entry& src) const;
|
||||
|
||||
void init_log_prefix();
|
||||
|
||||
struct construct_tx_param
|
||||
{
|
||||
std::vector<currency::tx_destination_entry> dsts;
|
||||
|
|
|
|||
|
|
@ -4,4 +4,4 @@ cd ..
|
|||
@mkdir build_msvc2013_64
|
||||
cd build_msvc2013_64
|
||||
|
||||
cmake -D CMAKE_PREFIX_PATH="%QT_PREFIX_PATH%"\msvc2013_64 -D BUILD_GUI=TRUE -D STATIC=FALSE -DBOOST_ROOT="%BOOST_ROOT%" -DBOOST_LIBRARYDIR="%BOOST_ROOT%\lib64-msvc-12.0" -G "Visual Studio 12 2013 Win64" ".."
|
||||
cmake -D BUILD_TESTS=TRUE -D CMAKE_PREFIX_PATH="%QT_PREFIX_PATH%"\msvc2013_64 -D BUILD_GUI=TRUE -D STATIC=FALSE -DBOOST_ROOT="%BOOST_ROOT%" -DBOOST_LIBRARYDIR="%BOOST_ROOT%\lib64-msvc-12.0" -G "Visual Studio 12 2013 Win64" ".."
|
||||
|
|
@ -4,4 +4,4 @@ cd ..
|
|||
@mkdir build_msvc2015_64
|
||||
cd build_msvc2015_64
|
||||
|
||||
cmake -D USE_PCH=TRUE -D CMAKE_PREFIX_PATH="%QT_PREFIX_PATH%"\msvc2015_64 -D BUILD_GUI=TRUE -D USE_OPENCL=TRUE -D STATIC=FALSE -DBOOST_ROOT="%BOOST_ROOT%" -DBOOST_LIBRARYDIR="%BOOST_ROOT%\lib64-msvc-14.0" -G "Visual Studio 14 2015 Win64" -T host=x64 ".."
|
||||
cmake -D USE_PCH=TRUE -D BUILD_TESTS=TRUE -D CMAKE_PREFIX_PATH="%QT_PREFIX_PATH%"\msvc2015_64 -D BUILD_GUI=TRUE -D USE_OPENCL=TRUE -D STATIC=FALSE -DBOOST_ROOT="%BOOST_ROOT%" -DBOOST_LIBRARYDIR="%BOOST_ROOT%\lib64-msvc-14.0" -G "Visual Studio 14 2015 Win64" -T host=x64 ".."
|
||||
|
|
@ -4,4 +4,4 @@ cd ..
|
|||
@mkdir build_msvc2017_64
|
||||
cd build_msvc2017_64
|
||||
|
||||
cmake -D USE_PCH=TRUE -D CMAKE_PREFIX_PATH="%QT_PREFIX_PATH%"\msvc2017_64 -D BUILD_GUI=TRUE -D USE_OPENCL=TRUE -D STATIC=FALSE -DBOOST_ROOT="%BOOST_ROOT%" -DBOOST_LIBRARYDIR="%BOOST_ROOT%\lib64-msvc-14.1" -G "Visual Studio 15 2017 Win64" -T host=x64 ".."
|
||||
cmake -D USE_PCH=TRUE -D BUILD_TESTS=TRUE -D CMAKE_PREFIX_PATH="%QT_PREFIX_PATH%"\msvc2017_64 -D BUILD_GUI=TRUE -D USE_OPENCL=TRUE -D STATIC=FALSE -DBOOST_ROOT="%BOOST_ROOT%" -DBOOST_LIBRARYDIR="%BOOST_ROOT%\lib64-msvc-14.1" -G "Visual Studio 15 2017 Win64" -T host=x64 ".."
|
||||
Loading…
Add table
Reference in a new issue