forked from lthn/blockchain
Merge branch 'master' into testnet2
This commit is contained in:
commit
dc77e8996d
60 changed files with 951 additions and 903 deletions
|
|
@ -201,8 +201,11 @@ else()
|
|||
endif()
|
||||
endif()
|
||||
|
||||
set(BUILD_TESTS FALSE CACHE BOOL "Build Zano tests")
|
||||
|
||||
add_subdirectory(contrib)
|
||||
add_subdirectory(src)
|
||||
add_subdirectory(tests)
|
||||
|
||||
if (BUILD_TESTS)
|
||||
add_subdirectory(tests)
|
||||
endif()
|
||||
|
|
|
|||
56
Makefile
56
Makefile
|
|
@ -1,28 +1,48 @@
|
|||
all: all-release
|
||||
# Copyright (c) 2014-2019 Zano Project
|
||||
# Copyright (c) 2014 The Cryptonote developers
|
||||
# Distributed under the MIT/X11 software license, see the accompanying
|
||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
cmake-debug:
|
||||
mkdir -p build/debug
|
||||
cd build/debug && cmake -D CMAKE_BUILD_TYPE=Debug ../..
|
||||
# Define CMake generator
|
||||
system := $(shell uname)
|
||||
ifneq (, $(findstring MINGW, $(system)))
|
||||
cmake_gen = -G 'MSYS Makefiles'
|
||||
endif
|
||||
|
||||
build-debug: cmake-debug
|
||||
cd build/debug && $(MAKE)
|
||||
cmake = cmake $(cmake_gen)
|
||||
|
||||
test-debug: build-debug
|
||||
cd build/debug && $(MAKE) test
|
||||
cmake_debug = $(cmake) -D CMAKE_BUILD_TYPE=Debug
|
||||
cmake_release = $(cmake) -D CMAKE_BUILD_TYPE=Release
|
||||
cmake_tests = $(cmake) -D BUILD_TESTS=ON
|
||||
|
||||
all-debug: build-debug
|
||||
# Helper macro
|
||||
define CMAKE
|
||||
mkdir -p $1 && cd $1 && $2 ../../
|
||||
endef
|
||||
|
||||
cmake-release:
|
||||
mkdir -p build/release
|
||||
cd build/release && cmake -D CMAKE_BUILD_TYPE=Release ../..
|
||||
build = build
|
||||
dir_debug = $(build)/debug
|
||||
dir_release = $(build)/release
|
||||
|
||||
build-release: cmake-release
|
||||
cd build/release && $(MAKE)
|
||||
all: release
|
||||
|
||||
test-release: build-release
|
||||
cd build/release && $(MAKE) test
|
||||
release:
|
||||
$(eval command += $(cmake_release))
|
||||
$(call CMAKE,$(dir_release),$(command)) && $(MAKE)
|
||||
|
||||
all-release: build-release
|
||||
test-release:
|
||||
$(eval command += $(cmake_release) $(cmake_tests))
|
||||
$(call CMAKE,$(dir_release),$(command)) && $(MAKE) && $(MAKE) test
|
||||
|
||||
test: test-release
|
||||
|
||||
debug:
|
||||
$(eval command += $(cmake_debug))
|
||||
$(call CMAKE,$(dir_debug),$(command)) && $(MAKE)
|
||||
|
||||
test-debug:
|
||||
$(eval command += $(cmake_debug) $(cmake_tests))
|
||||
$(call CMAKE,$(dir_debug),$(command)) && $(MAKE) && $(MAKE) test
|
||||
|
||||
clean:
|
||||
rm -rf build
|
||||
|
|
@ -30,4 +50,4 @@ clean:
|
|||
tags:
|
||||
ctags -R --sort=1 --c++-kinds=+p --fields=+iaS --extra=+q --language-force=C++ src contrib tests/gtest
|
||||
|
||||
.PHONY: all cmake-debug build-debug test-debug all-debug cmake-release build-release test-release all-release clean tags
|
||||
.PHONY: all release test-release test all-debug debug test-debug clean tags
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -268,7 +268,7 @@ struct payment_method_summary
|
|||
void process_payment_entrie(payment_method_summary& pms, const std::string& amount_in_coin, uint64_t amount_in_this, const std::string& to_usd_rate)
|
||||
{
|
||||
double d_amount_in_coin = std::stod(amount_in_coin);
|
||||
double d_to_usd_rate = std::stod(to_usd_rate);
|
||||
// double d_to_usd_rate = std::stod(to_usd_rate);
|
||||
//CHECK_AND_ASSERT_THROW_MES(d_amount_in_coin, "unable to parse amount_in_coin: " << amount_in_coin);
|
||||
CHECK_AND_ASSERT_THROW_MES(amount_in_this, "unable to parse amount_this");
|
||||
//CHECK_AND_ASSERT_THROW_MES(d_to_usd_rate, "unable to parse to_usd_rate: " << to_usd_rate);
|
||||
|
|
@ -960,7 +960,6 @@ bool handle_download_peer_log(po::variables_map& vm)
|
|||
|
||||
const uint64_t chunk_size = 1024 * 1024 * 5;
|
||||
uint64_t end_offset = start_offset;
|
||||
uint64_t bytes = 0;
|
||||
while (true)
|
||||
{
|
||||
req.log_chunk_offset = end_offset;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -12,6 +12,8 @@ namespace currency
|
|||
{
|
||||
struct i_bc_service
|
||||
{
|
||||
virtual ~i_bc_service() = default;
|
||||
|
||||
virtual std::string get_id() = 0;
|
||||
virtual bool init(const std::string& config_folder, const boost::program_options::variables_map& vm) = 0;
|
||||
virtual bool deinit() = 0;
|
||||
|
|
|
|||
|
|
@ -3546,7 +3546,7 @@ bool blockchain_storage::check_tx_inputs(const transaction& tx, const crypto::ha
|
|||
if (!m_is_in_checkpoint_zone)
|
||||
{
|
||||
CHECK_AND_ASSERT_MES(tx.signatures.size() == sig_index, false, "tx signatures count differs from inputs");
|
||||
if (!get_tx_flags(tx)&TX_FLAG_SIGNATURE_MODE_SEPARATE)
|
||||
if (!(get_tx_flags(tx) & TX_FLAG_SIGNATURE_MODE_SEPARATE))
|
||||
{
|
||||
bool r = validate_attachment_info(tx.extra, tx.attachment, false);
|
||||
CHECK_AND_ASSERT_MES(r, false, "Failed to validate attachments in tx " << tx_prefix_hash << ": incorrect extra_attachment_info in tx.extra");
|
||||
|
|
|
|||
|
|
@ -1109,7 +1109,7 @@ namespace currency
|
|||
att_count++;
|
||||
}
|
||||
}
|
||||
if (!flags&TX_FLAG_SIGNATURE_MODE_SEPARATE)
|
||||
if (!(flags & TX_FLAG_SIGNATURE_MODE_SEPARATE))
|
||||
{
|
||||
//take hash from attachment and put into extra
|
||||
if (tx.attachment.size())
|
||||
|
|
@ -2374,7 +2374,7 @@ namespace currency
|
|||
//---------------------------------------------------------------
|
||||
bool is_pos_block(const block& b)
|
||||
{
|
||||
if (!b.flags&CURRENCY_BLOCK_FLAG_POS_BLOCK)
|
||||
if (!(b.flags & CURRENCY_BLOCK_FLAG_POS_BLOCK))
|
||||
return false;
|
||||
return is_pos_block(b.miner_tx);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -124,7 +124,7 @@ namespace tools
|
|||
return m_rpc.on_get_current_core_tx_expiration_median(req, res, m_cntxt_stub);
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------------------------------------
|
||||
bool call_COMMAND_RPC_GET_POOL_INFO(const currency::COMMAND_RPC_GET_POOL_INFO::request& req, currency::COMMAND_RPC_GET_POOL_INFO::response& res)
|
||||
bool call_COMMAND_RPC_GET_POOL_INFO(const currency::COMMAND_RPC_GET_POOL_INFO::request& req, currency::COMMAND_RPC_GET_POOL_INFO::response& res) override
|
||||
{
|
||||
return m_rpc.on_get_pool_info(req, res, m_cntxt_stub);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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("[W:???id=") + epee::string_tools::num_to_string_fast(wallet_id) + "]";
|
||||
|
||||
return std::string("[W:") + 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)
|
||||
|
|
@ -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()
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -166,10 +166,11 @@
|
|||
"BUTTON_ASSIGN": "Assign",
|
||||
"BUTTON_CANCEL": "Cancel",
|
||||
"FORM_ERRORS": {
|
||||
"NAME_REQUIRED": "Name is required.",
|
||||
"NAME_WRONG": "Alias has wrong name.",
|
||||
"NAME_LENGTH": "The alias must be 6-25 characters long.",
|
||||
"NAME_EXISTS": "Alias name already exists."
|
||||
"NAME_REQUIRED": "Name is required",
|
||||
"NAME_WRONG": "Alias has wrong name",
|
||||
"NAME_LENGTH": "The alias must be 6-25 characters long",
|
||||
"NAME_EXISTS": "Alias name already exists",
|
||||
"NO_MONEY": "You do not have enough funds to assign this alias"
|
||||
},
|
||||
"ONE_ALIAS": "You can create only one alias per wallet",
|
||||
"REQUEST_ADD_REG": "The alias will be assigned within 10 minutes"
|
||||
|
|
|
|||
|
|
@ -310,6 +310,7 @@ input[type='checkbox'].style-checkbox {
|
|||
.table-tooltip {
|
||||
font-size: 1.3rem;
|
||||
padding: 1rem 2rem;
|
||||
white-space: pre-wrap;
|
||||
|
||||
@include themify($themes) {
|
||||
background: themed(tooltipBackgroundColor);
|
||||
|
|
@ -320,6 +321,23 @@ input[type='checkbox'].style-checkbox {
|
|||
&.ng-tooltip-top {
|
||||
margin-top: -1rem;
|
||||
|
||||
&:before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
bottom: -2rem;
|
||||
left: calc(50% - 1rem);
|
||||
border-width: 1rem;
|
||||
border-style: solid;
|
||||
|
||||
@include themify($themes) {
|
||||
border-color: themed(tooltipBackgroundColor) transparent transparent transparent;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&.ng-tooltip-top-left {
|
||||
margin-top: -1rem;
|
||||
|
||||
&:before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
|
|
@ -334,19 +352,70 @@ input[type='checkbox'].style-checkbox {
|
|||
}
|
||||
}
|
||||
|
||||
&.ng-tooltip-top-right {
|
||||
margin-top: -1rem;
|
||||
|
||||
&:before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
bottom: -1rem;
|
||||
right: 0.7rem;
|
||||
border-width: 0.5rem;
|
||||
border-style: solid;
|
||||
|
||||
@include themify($themes) {
|
||||
border-color: themed(tooltipBackgroundColor) themed(tooltipBackgroundColor) transparent transparent;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&.ng-tooltip-bottom {
|
||||
margin-top: 1rem;
|
||||
|
||||
&:before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
top: -2rem;
|
||||
left: calc(50% - 1rem);
|
||||
border-width: 1rem;
|
||||
border-style: solid;
|
||||
|
||||
@include themify($themes) {
|
||||
border-color: transparent transparent themed(tooltipBackgroundColor) transparent;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&.ng-tooltip-bottom-left {
|
||||
margin-top: 1rem;
|
||||
|
||||
&:before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
top: -1rem;
|
||||
left: 0.7rem;
|
||||
border-width: 1rem 0 0 1rem;
|
||||
border-width: 0.5rem;
|
||||
border-style: solid;
|
||||
|
||||
@include themify($themes) {
|
||||
border-color: transparent transparent transparent themed(tooltipBackgroundColor);
|
||||
border-color: transparent transparent themed(tooltipBackgroundColor) themed(tooltipBackgroundColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&.ng-tooltip-bottom-right {
|
||||
margin-top: 1rem;
|
||||
|
||||
&:before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
top: -1rem;
|
||||
right: 0.7rem;
|
||||
border-width: 0.5rem;
|
||||
border-style: solid;
|
||||
|
||||
@include themify($themes) {
|
||||
border-color: transparent themed(tooltipBackgroundColor) themed(tooltipBackgroundColor) transparent;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,6 +41,13 @@ app-sidebar {
|
|||
}
|
||||
}
|
||||
|
||||
.icon {
|
||||
|
||||
@include themify($themes) {
|
||||
background-color: themed(blueTextColor);
|
||||
}
|
||||
}
|
||||
|
||||
.indicator {
|
||||
|
||||
@include themify($themes) {
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -649,7 +649,7 @@ module.exports = function (NAME, wrapper, methods, common, IS_MAP, IS_WEAK) {
|
|||
/*! no static exports found */
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
var core = module.exports = { version: '2.6.2' };
|
||||
var core = module.exports = { version: '2.6.1' };
|
||||
if (typeof __e == 'number') __e = core; // eslint-disable-line no-undef
|
||||
|
||||
|
||||
|
|
@ -1807,7 +1807,7 @@ var store = global[SHARED] || (global[SHARED] = {});
|
|||
})('versions', []).push({
|
||||
version: core.version,
|
||||
mode: __webpack_require__(/*! ./_library */ "./node_modules/core-js/modules/_library.js") ? 'pure' : 'global',
|
||||
copyright: '© 2019 Denis Pushkarev (zloirock.ru)'
|
||||
copyright: '© 2018 Denis Pushkarev (zloirock.ru)'
|
||||
});
|
||||
|
||||
|
||||
|
|
@ -2364,6 +2364,7 @@ $metadata.exp({ metadata: function metadata(metadataKey, metadataValue) {
|
|||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
var Zone$1 = (function (global) {
|
||||
var FUNCTION = 'function';
|
||||
var performance = global['performance'];
|
||||
function mark(name) {
|
||||
performance && performance['mark'] && performance['mark'](name);
|
||||
|
|
@ -2372,26 +2373,12 @@ var Zone$1 = (function (global) {
|
|||
performance && performance['measure'] && performance['measure'](name, label);
|
||||
}
|
||||
mark('Zone');
|
||||
var checkDuplicate = global[('__zone_symbol__forceDuplicateZoneCheck')] === true;
|
||||
if (global['Zone']) {
|
||||
// if global['Zone'] already exists (maybe zone.js was already loaded or
|
||||
// some other lib also registered a global object named Zone), we may need
|
||||
// to throw an error, but sometimes user may not want this error.
|
||||
// For example,
|
||||
// we have two web pages, page1 includes zone.js, page2 doesn't.
|
||||
// and the 1st time user load page1 and page2, everything work fine,
|
||||
// but when user load page2 again, error occurs because global['Zone'] already exists.
|
||||
// so we add a flag to let user choose whether to throw this error or not.
|
||||
// By default, if existing Zone is from zone.js, we will not throw the error.
|
||||
if (checkDuplicate || typeof global['Zone'].__symbol__ !== 'function') {
|
||||
throw new Error('Zone already loaded.');
|
||||
}
|
||||
else {
|
||||
return global['Zone'];
|
||||
}
|
||||
throw new Error('Zone already loaded.');
|
||||
}
|
||||
var Zone = /** @class */ (function () {
|
||||
function Zone(parent, zoneSpec) {
|
||||
this._properties = null;
|
||||
this._parent = parent;
|
||||
this._name = zoneSpec ? zoneSpec.name || 'unnamed' : '<root>';
|
||||
this._properties = zoneSpec && zoneSpec.properties || {};
|
||||
|
|
@ -2434,9 +2421,7 @@ var Zone$1 = (function (global) {
|
|||
});
|
||||
Zone.__load_patch = function (name, fn) {
|
||||
if (patches.hasOwnProperty(name)) {
|
||||
if (checkDuplicate) {
|
||||
throw Error('Already loaded patch: ' + name);
|
||||
}
|
||||
throw Error('Already loaded patch: ' + name);
|
||||
}
|
||||
else if (!global['__Zone_disable_' + name]) {
|
||||
var perfName = 'Zone:' + name;
|
||||
|
|
@ -2480,7 +2465,7 @@ var Zone$1 = (function (global) {
|
|||
return this._zoneDelegate.fork(this, zoneSpec);
|
||||
};
|
||||
Zone.prototype.wrap = function (callback, source) {
|
||||
if (typeof callback !== 'function') {
|
||||
if (typeof callback !== FUNCTION) {
|
||||
throw new Error('Expecting function got: ' + callback);
|
||||
}
|
||||
var _callback = this._zoneDelegate.intercept(this, callback, source);
|
||||
|
|
@ -2490,6 +2475,9 @@ var Zone$1 = (function (global) {
|
|||
};
|
||||
};
|
||||
Zone.prototype.run = function (callback, applyThis, applyArgs, source) {
|
||||
if (applyThis === void 0) { applyThis = undefined; }
|
||||
if (applyArgs === void 0) { applyArgs = null; }
|
||||
if (source === void 0) { source = null; }
|
||||
_currentZoneFrame = { parent: _currentZoneFrame, zone: this };
|
||||
try {
|
||||
return this._zoneDelegate.invoke(this, callback, applyThis, applyArgs, source);
|
||||
|
|
@ -2500,6 +2488,8 @@ var Zone$1 = (function (global) {
|
|||
};
|
||||
Zone.prototype.runGuarded = function (callback, applyThis, applyArgs, source) {
|
||||
if (applyThis === void 0) { applyThis = null; }
|
||||
if (applyArgs === void 0) { applyArgs = null; }
|
||||
if (source === void 0) { source = null; }
|
||||
_currentZoneFrame = { parent: _currentZoneFrame, zone: this };
|
||||
try {
|
||||
try {
|
||||
|
|
@ -2523,7 +2513,10 @@ var Zone$1 = (function (global) {
|
|||
// https://github.com/angular/zone.js/issues/778, sometimes eventTask
|
||||
// will run in notScheduled(canceled) state, we should not try to
|
||||
// run such kind of task but just return
|
||||
if (task.state === notScheduled && (task.type === eventTask || task.type === macroTask)) {
|
||||
// we have to define an variable here, if not
|
||||
// typescript compiler will complain below
|
||||
var isNotScheduled = task.state === notScheduled;
|
||||
if (isNotScheduled && task.type === eventTask) {
|
||||
return;
|
||||
}
|
||||
var reEntryGuard = task.state != running;
|
||||
|
|
@ -2534,7 +2527,7 @@ var Zone$1 = (function (global) {
|
|||
_currentZoneFrame = { parent: _currentZoneFrame, zone: this };
|
||||
try {
|
||||
if (task.type == macroTask && task.data && !task.data.isPeriodic) {
|
||||
task.cancelFn = undefined;
|
||||
task.cancelFn = null;
|
||||
}
|
||||
try {
|
||||
return this._zoneDelegate.invokeTask(this, task, applyThis, applyArgs);
|
||||
|
|
@ -2570,7 +2563,8 @@ var Zone$1 = (function (global) {
|
|||
var newZone = this;
|
||||
while (newZone) {
|
||||
if (newZone === task.zone) {
|
||||
throw Error("can not reschedule task to " + this.name + " which is descendants of the original zone " + task.zone.name);
|
||||
throw Error("can not reschedule task to " + this
|
||||
.name + " which is descendants of the original zone " + task.zone.name);
|
||||
}
|
||||
newZone = newZone.parent;
|
||||
}
|
||||
|
|
@ -2600,7 +2594,7 @@ var Zone$1 = (function (global) {
|
|||
return task;
|
||||
};
|
||||
Zone.prototype.scheduleMicroTask = function (source, callback, data, customSchedule) {
|
||||
return this.scheduleTask(new ZoneTask(microTask, source, callback, data, customSchedule, undefined));
|
||||
return this.scheduleTask(new ZoneTask(microTask, source, callback, data, customSchedule, null));
|
||||
};
|
||||
Zone.prototype.scheduleMacroTask = function (source, callback, data, customSchedule, customCancel) {
|
||||
return this.scheduleTask(new ZoneTask(macroTask, source, callback, data, customSchedule, customCancel));
|
||||
|
|
@ -2641,14 +2635,16 @@ var Zone$1 = (function (global) {
|
|||
}());
|
||||
var DELEGATE_ZS = {
|
||||
name: '',
|
||||
onHasTask: function (delegate, _, target, hasTaskState) { return delegate.hasTask(target, hasTaskState); },
|
||||
onHasTask: function (delegate, _, target, hasTaskState) {
|
||||
return delegate.hasTask(target, hasTaskState);
|
||||
},
|
||||
onScheduleTask: function (delegate, _, target, task) {
|
||||
return delegate.scheduleTask(target, task);
|
||||
},
|
||||
onInvokeTask: function (delegate, _, target, task, applyThis, applyArgs) {
|
||||
return delegate.invokeTask(target, task, applyThis, applyArgs);
|
||||
},
|
||||
onCancelTask: function (delegate, _, target, task) { return delegate.cancelTask(target, task); }
|
||||
onInvokeTask: function (delegate, _, target, task, applyThis, applyArgs) { return delegate.invokeTask(target, task, applyThis, applyArgs); },
|
||||
onCancelTask: function (delegate, _, target, task) {
|
||||
return delegate.cancelTask(target, task);
|
||||
}
|
||||
};
|
||||
var ZoneDelegate = /** @class */ (function () {
|
||||
function ZoneDelegate(zone, parentDelegate, zoneSpec) {
|
||||
|
|
@ -2676,8 +2672,8 @@ var Zone$1 = (function (global) {
|
|||
zoneSpec && (zoneSpec.onHandleError ? this.zone : parentDelegate.zone);
|
||||
this._scheduleTaskZS =
|
||||
zoneSpec && (zoneSpec.onScheduleTask ? zoneSpec : parentDelegate._scheduleTaskZS);
|
||||
this._scheduleTaskDlgt = zoneSpec &&
|
||||
(zoneSpec.onScheduleTask ? parentDelegate : parentDelegate._scheduleTaskDlgt);
|
||||
this._scheduleTaskDlgt =
|
||||
zoneSpec && (zoneSpec.onScheduleTask ? parentDelegate : parentDelegate._scheduleTaskDlgt);
|
||||
this._scheduleTaskCurrZone =
|
||||
zoneSpec && (zoneSpec.onScheduleTask ? this.zone : parentDelegate.zone);
|
||||
this._invokeTaskZS =
|
||||
|
|
@ -2732,7 +2728,8 @@ var Zone$1 = (function (global) {
|
|||
callback;
|
||||
};
|
||||
ZoneDelegate.prototype.invoke = function (targetZone, callback, applyThis, applyArgs, source) {
|
||||
return this._invokeZS ? this._invokeZS.onInvoke(this._invokeDlgt, this._invokeCurrZone, targetZone, callback, applyThis, applyArgs, source) :
|
||||
return this._invokeZS ?
|
||||
this._invokeZS.onInvoke(this._invokeDlgt, this._invokeCurrZone, targetZone, callback, applyThis, applyArgs, source) :
|
||||
callback.apply(applyThis, applyArgs);
|
||||
};
|
||||
ZoneDelegate.prototype.handleError = function (targetZone, error) {
|
||||
|
|
@ -2764,7 +2761,8 @@ var Zone$1 = (function (global) {
|
|||
return returnTask;
|
||||
};
|
||||
ZoneDelegate.prototype.invokeTask = function (targetZone, task, applyThis, applyArgs) {
|
||||
return this._invokeTaskZS ? this._invokeTaskZS.onInvokeTask(this._invokeTaskDlgt, this._invokeTaskCurrZone, targetZone, task, applyThis, applyArgs) :
|
||||
return this._invokeTaskZS ?
|
||||
this._invokeTaskZS.onInvokeTask(this._invokeTaskDlgt, this._invokeTaskCurrZone, targetZone, task, applyThis, applyArgs) :
|
||||
task.callback.apply(applyThis, applyArgs);
|
||||
};
|
||||
ZoneDelegate.prototype.cancelTask = function (targetZone, task) {
|
||||
|
|
@ -2784,7 +2782,7 @@ var Zone$1 = (function (global) {
|
|||
// hasTask should not throw error so other ZoneDelegate
|
||||
// can still trigger hasTask callback
|
||||
try {
|
||||
this._hasTaskZS &&
|
||||
return this._hasTaskZS &&
|
||||
this._hasTaskZS.onHasTask(this._hasTaskDlgt, this._hasTaskCurrZone, targetZone, isEmpty);
|
||||
}
|
||||
catch (err) {
|
||||
|
|
@ -2874,12 +2872,14 @@ var Zone$1 = (function (global) {
|
|||
}
|
||||
}
|
||||
else {
|
||||
throw new Error(this.type + " '" + this.source + "': can not transition to '" + toState + "', expecting state '" + fromState1 + "'" + (fromState2 ? ' or \'' + fromState2 + '\'' : '') + ", was '" + this._state + "'.");
|
||||
throw new Error(this.type + " '" + this.source + "': can not transition to '" + toState + "', expecting state '" + fromState1 + "'" + (fromState2 ?
|
||||
' or \'' + fromState2 + '\'' :
|
||||
'') + ", was '" + this._state + "'.");
|
||||
}
|
||||
};
|
||||
ZoneTask.prototype.toString = function () {
|
||||
if (this.data && typeof this.data.handleId !== 'undefined') {
|
||||
return this.data.handleId.toString();
|
||||
return this.data.handleId;
|
||||
}
|
||||
else {
|
||||
return Object.prototype.toString.call(this);
|
||||
|
|
@ -2920,13 +2920,7 @@ var Zone$1 = (function (global) {
|
|||
}
|
||||
}
|
||||
if (nativeMicroTaskQueuePromise) {
|
||||
var nativeThen = nativeMicroTaskQueuePromise[symbolThen];
|
||||
if (!nativeThen) {
|
||||
// native Promise is not patchable, we need to use `then` directly
|
||||
// issue 1078
|
||||
nativeThen = nativeMicroTaskQueuePromise['then'];
|
||||
}
|
||||
nativeThen.call(nativeMicroTaskQueuePromise, drainMicroTaskQueue);
|
||||
nativeMicroTaskQueuePromise[symbolThen](drainMicroTaskQueue);
|
||||
}
|
||||
else {
|
||||
global[symbolSetTimeout](drainMicroTaskQueue, 0);
|
||||
|
|
@ -2973,13 +2967,12 @@ var Zone$1 = (function (global) {
|
|||
patchEventTarget: function () { return []; },
|
||||
patchOnProperties: noop,
|
||||
patchMethod: function () { return noop; },
|
||||
bindArguments: function () { return []; },
|
||||
patchThen: function () { return noop; },
|
||||
bindArguments: function () { return null; },
|
||||
setNativePromise: function (NativePromise) {
|
||||
// sometimes NativePromise.resolve static function
|
||||
// is not ready yet, (such as core-js/es6.promise)
|
||||
// so we need to check here.
|
||||
if (NativePromise && typeof NativePromise.resolve === 'function') {
|
||||
if (NativePromise && typeof NativePromise.resolve === FUNCTION) {
|
||||
nativeMicroTaskQueuePromise = NativePromise.resolve(0);
|
||||
}
|
||||
},
|
||||
|
|
@ -2995,16 +2988,6 @@ var Zone$1 = (function (global) {
|
|||
return global['Zone'] = Zone;
|
||||
})(typeof window !== 'undefined' && window || typeof self !== 'undefined' && self || global);
|
||||
|
||||
var __values = (undefined && undefined.__values) || function (o) {
|
||||
var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0;
|
||||
if (m) return m.call(o);
|
||||
return {
|
||||
next: function () {
|
||||
if (o && i >= o.length) o = void 0;
|
||||
return { value: o && o[i++], done: !o };
|
||||
}
|
||||
};
|
||||
};
|
||||
Zone.__load_patch('ZoneAwarePromise', function (global, Zone, api) {
|
||||
var ObjectGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
||||
var ObjectDefineProperty = Object.defineProperty;
|
||||
|
|
@ -3147,7 +3130,7 @@ Zone.__load_patch('ZoneAwarePromise', function (global, Zone, api) {
|
|||
var queue = promise[symbolValue];
|
||||
promise[symbolValue] = value;
|
||||
if (promise[symbolFinally] === symbolFinally) {
|
||||
// the promise is generated by Promise.prototype.finally
|
||||
// the promise is generated by Promise.prototype.finally
|
||||
if (state === RESOLVED) {
|
||||
// the state is resolved, should ignore the value
|
||||
// and use parent promise value
|
||||
|
|
@ -3231,9 +3214,7 @@ Zone.__load_patch('ZoneAwarePromise', function (global, Zone, api) {
|
|||
chainPromise[symbolParentPromiseState] = promiseState;
|
||||
}
|
||||
// should not pass value to finally callback
|
||||
var value = zone.run(delegate, undefined, isFinallyPromise && delegate !== forwardRejection && delegate !== forwardResolution ?
|
||||
[] :
|
||||
[parentPromiseValue]);
|
||||
var value = zone.run(delegate, undefined, isFinallyPromise && delegate !== forwardRejection && delegate !== forwardResolution ? [] : [parentPromiseValue]);
|
||||
resolvePromise(chainPromise, true, value);
|
||||
}
|
||||
catch (error) {
|
||||
|
|
@ -3268,7 +3249,6 @@ Zone.__load_patch('ZoneAwarePromise', function (global, Zone, api) {
|
|||
return resolvePromise(new this(null), REJECTED, error);
|
||||
};
|
||||
ZoneAwarePromise.race = function (values) {
|
||||
var e_1, _a;
|
||||
var resolve;
|
||||
var reject;
|
||||
var promise = new this(function (res, rej) {
|
||||
|
|
@ -3281,70 +3261,40 @@ Zone.__load_patch('ZoneAwarePromise', function (global, Zone, api) {
|
|||
function onReject(error) {
|
||||
promise && (promise = false || reject(error));
|
||||
}
|
||||
try {
|
||||
for (var values_1 = __values(values), values_1_1 = values_1.next(); !values_1_1.done; values_1_1 = values_1.next()) {
|
||||
var value = values_1_1.value;
|
||||
if (!isThenable(value)) {
|
||||
value = this.resolve(value);
|
||||
}
|
||||
value.then(onResolve, onReject);
|
||||
for (var _i = 0, values_1 = values; _i < values_1.length; _i++) {
|
||||
var value = values_1[_i];
|
||||
if (!isThenable(value)) {
|
||||
value = this.resolve(value);
|
||||
}
|
||||
}
|
||||
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
||||
finally {
|
||||
try {
|
||||
if (values_1_1 && !values_1_1.done && (_a = values_1.return)) _a.call(values_1);
|
||||
}
|
||||
finally { if (e_1) throw e_1.error; }
|
||||
value.then(onResolve, onReject);
|
||||
}
|
||||
return promise;
|
||||
};
|
||||
ZoneAwarePromise.all = function (values) {
|
||||
var e_2, _a;
|
||||
var resolve;
|
||||
var reject;
|
||||
var promise = new this(function (res, rej) {
|
||||
resolve = res;
|
||||
reject = rej;
|
||||
});
|
||||
// Start at 2 to prevent prematurely resolving if .then is called immediately.
|
||||
var unresolvedCount = 2;
|
||||
var valueIndex = 0;
|
||||
var count = 0;
|
||||
var resolvedValues = [];
|
||||
var _loop_2 = function (value) {
|
||||
for (var _i = 0, values_2 = values; _i < values_2.length; _i++) {
|
||||
var value = values_2[_i];
|
||||
if (!isThenable(value)) {
|
||||
value = this_1.resolve(value);
|
||||
value = this.resolve(value);
|
||||
}
|
||||
var curValueIndex = valueIndex;
|
||||
value.then(function (value) {
|
||||
resolvedValues[curValueIndex] = value;
|
||||
unresolvedCount--;
|
||||
if (unresolvedCount === 0) {
|
||||
value.then((function (index) { return function (value) {
|
||||
resolvedValues[index] = value;
|
||||
count--;
|
||||
if (!count) {
|
||||
resolve(resolvedValues);
|
||||
}
|
||||
}, reject);
|
||||
unresolvedCount++;
|
||||
valueIndex++;
|
||||
};
|
||||
var this_1 = this;
|
||||
try {
|
||||
for (var values_2 = __values(values), values_2_1 = values_2.next(); !values_2_1.done; values_2_1 = values_2.next()) {
|
||||
var value = values_2_1.value;
|
||||
_loop_2(value);
|
||||
}
|
||||
}; })(count), reject);
|
||||
count++;
|
||||
}
|
||||
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
||||
finally {
|
||||
try {
|
||||
if (values_2_1 && !values_2_1.done && (_a = values_2.return)) _a.call(values_2);
|
||||
}
|
||||
finally { if (e_2) throw e_2.error; }
|
||||
}
|
||||
// Make the unresolvedCount zero-based again.
|
||||
unresolvedCount -= 2;
|
||||
if (unresolvedCount === 0) {
|
||||
if (!count)
|
||||
resolve(resolvedValues);
|
||||
}
|
||||
return promise;
|
||||
};
|
||||
ZoneAwarePromise.prototype.then = function (onFulfilled, onRejected) {
|
||||
|
|
@ -3440,112 +3390,31 @@ Zone.__load_patch('ZoneAwarePromise', function (global, Zone, api) {
|
|||
};
|
||||
Ctor[symbolThenPatched] = true;
|
||||
}
|
||||
api.patchThen = patchThen;
|
||||
function zoneify(fn) {
|
||||
return function () {
|
||||
var resultPromise = fn.apply(this, arguments);
|
||||
if (resultPromise instanceof ZoneAwarePromise) {
|
||||
return resultPromise;
|
||||
}
|
||||
var ctor = resultPromise.constructor;
|
||||
if (!ctor[symbolThenPatched]) {
|
||||
patchThen(ctor);
|
||||
}
|
||||
return resultPromise;
|
||||
};
|
||||
}
|
||||
if (NativePromise) {
|
||||
patchThen(NativePromise);
|
||||
var fetch_1 = global['fetch'];
|
||||
if (typeof fetch_1 == 'function') {
|
||||
global['fetch'] = zoneify(fetch_1);
|
||||
}
|
||||
}
|
||||
// This is not part of public API, but it is useful for tests, so we expose it.
|
||||
Promise[Zone.__symbol__('uncaughtPromiseErrors')] = _uncaughtPromiseErrors;
|
||||
return ZoneAwarePromise;
|
||||
});
|
||||
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google Inc. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
Zone.__load_patch('fetch', function (global, Zone, api) {
|
||||
var fetch = global['fetch'];
|
||||
var ZoneAwarePromise = global.Promise;
|
||||
var symbolThenPatched = api.symbol('thenPatched');
|
||||
var fetchTaskScheduling = api.symbol('fetchTaskScheduling');
|
||||
var fetchTaskAborting = api.symbol('fetchTaskAborting');
|
||||
if (typeof fetch !== 'function') {
|
||||
return;
|
||||
}
|
||||
var OriginalAbortController = global['AbortController'];
|
||||
var supportAbort = typeof OriginalAbortController === 'function';
|
||||
var abortNative = null;
|
||||
if (supportAbort) {
|
||||
global['AbortController'] = function () {
|
||||
var abortController = new OriginalAbortController();
|
||||
var signal = abortController.signal;
|
||||
signal.abortController = abortController;
|
||||
return abortController;
|
||||
};
|
||||
abortNative = api.patchMethod(OriginalAbortController.prototype, 'abort', function (delegate) { return function (self, args) {
|
||||
if (self.task) {
|
||||
return self.task.zone.cancelTask(self.task);
|
||||
}
|
||||
return delegate.apply(self, args);
|
||||
}; });
|
||||
}
|
||||
var placeholder = function () { };
|
||||
global['fetch'] = function () {
|
||||
var _this = this;
|
||||
var args = Array.prototype.slice.call(arguments);
|
||||
var options = args.length > 1 ? args[1] : null;
|
||||
var signal = options && options.signal;
|
||||
return new Promise(function (res, rej) {
|
||||
var task = Zone.current.scheduleMacroTask('fetch', placeholder, args, function () {
|
||||
var fetchPromise;
|
||||
var zone = Zone.current;
|
||||
try {
|
||||
zone[fetchTaskScheduling] = true;
|
||||
fetchPromise = fetch.apply(_this, args);
|
||||
}
|
||||
catch (error) {
|
||||
rej(error);
|
||||
return;
|
||||
}
|
||||
finally {
|
||||
zone[fetchTaskScheduling] = false;
|
||||
}
|
||||
if (!(fetchPromise instanceof ZoneAwarePromise)) {
|
||||
var ctor = fetchPromise.constructor;
|
||||
if (!ctor[symbolThenPatched]) {
|
||||
api.patchThen(ctor);
|
||||
}
|
||||
}
|
||||
fetchPromise.then(function (resource) {
|
||||
if (task.state !== 'notScheduled') {
|
||||
task.invoke();
|
||||
}
|
||||
res(resource);
|
||||
}, function (error) {
|
||||
if (task.state !== 'notScheduled') {
|
||||
task.invoke();
|
||||
}
|
||||
rej(error);
|
||||
});
|
||||
}, function () {
|
||||
if (!supportAbort) {
|
||||
rej('No AbortController supported, can not cancel fetch');
|
||||
return;
|
||||
}
|
||||
if (signal && signal.abortController && !signal.aborted &&
|
||||
typeof signal.abortController.abort === 'function' && abortNative) {
|
||||
try {
|
||||
Zone.current[fetchTaskAborting] = true;
|
||||
abortNative.call(signal.abortController);
|
||||
}
|
||||
finally {
|
||||
Zone.current[fetchTaskAborting] = false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
rej('cancel fetch need a AbortController.signal');
|
||||
}
|
||||
});
|
||||
if (signal && signal.abortController) {
|
||||
signal.abortController.task = task;
|
||||
}
|
||||
});
|
||||
};
|
||||
});
|
||||
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google Inc. All Rights Reserved.
|
||||
|
|
@ -3661,23 +3530,9 @@ var wrapFn = function (event) {
|
|||
}
|
||||
var target = this || event.target || _global;
|
||||
var listener = target[eventNameSymbol];
|
||||
var result;
|
||||
if (isBrowser && target === internalWindow && event.type === 'error') {
|
||||
// window.onerror have different signiture
|
||||
// https://developer.mozilla.org/en-US/docs/Web/API/GlobalEventHandlers/onerror#window.onerror
|
||||
// and onerror callback will prevent default when callback return true
|
||||
var errorEvent = event;
|
||||
result = listener &&
|
||||
listener.call(this, errorEvent.message, errorEvent.filename, errorEvent.lineno, errorEvent.colno, errorEvent.error);
|
||||
if (result === true) {
|
||||
event.preventDefault();
|
||||
}
|
||||
}
|
||||
else {
|
||||
result = listener && listener.apply(this, arguments);
|
||||
if (result != undefined && !result) {
|
||||
event.preventDefault();
|
||||
}
|
||||
var result = listener && listener.apply(this, arguments);
|
||||
if (result != undefined && !result) {
|
||||
event.preventDefault();
|
||||
}
|
||||
return result;
|
||||
};
|
||||
|
|
@ -3695,10 +3550,6 @@ function patchProperty(obj, prop, prototype) {
|
|||
if (!desc || !desc.configurable) {
|
||||
return;
|
||||
}
|
||||
var onPropPatchedSymbol = zoneSymbol('on' + prop + 'patched');
|
||||
if (obj.hasOwnProperty(onPropPatchedSymbol) && obj[onPropPatchedSymbol]) {
|
||||
return;
|
||||
}
|
||||
// A property descriptor cannot have getter/setter and be writable
|
||||
// deleting the writable and value properties avoids this error:
|
||||
//
|
||||
|
|
@ -3776,7 +3627,6 @@ function patchProperty(obj, prop, prototype) {
|
|||
return null;
|
||||
};
|
||||
ObjectDefineProperty(obj, prop, desc);
|
||||
obj[onPropPatchedSymbol] = true;
|
||||
}
|
||||
function patchOnProperties(obj, properties, prototype) {
|
||||
if (properties) {
|
||||
|
|
@ -3867,31 +3717,6 @@ function patchClass(className) {
|
|||
}
|
||||
}
|
||||
}
|
||||
function copySymbolProperties(src, dest) {
|
||||
if (typeof Object.getOwnPropertySymbols !== 'function') {
|
||||
return;
|
||||
}
|
||||
var symbols = Object.getOwnPropertySymbols(src);
|
||||
symbols.forEach(function (symbol) {
|
||||
var desc = Object.getOwnPropertyDescriptor(src, symbol);
|
||||
Object.defineProperty(dest, symbol, {
|
||||
get: function () {
|
||||
return src[symbol];
|
||||
},
|
||||
set: function (value) {
|
||||
if (desc && (!desc.writable || typeof desc.set !== 'function')) {
|
||||
// if src[symbol] is not writable or not have a setter, just return
|
||||
return;
|
||||
}
|
||||
src[symbol] = value;
|
||||
},
|
||||
enumerable: desc ? desc.enumerable : true,
|
||||
configurable: desc ? desc.configurable : true
|
||||
});
|
||||
});
|
||||
}
|
||||
var shouldCopySymbolProperties = false;
|
||||
|
||||
function patchMethod(target, name, patchFn) {
|
||||
var proto = target;
|
||||
while (proto && !proto.hasOwnProperty(name)) {
|
||||
|
|
@ -3902,7 +3727,7 @@ function patchMethod(target, name, patchFn) {
|
|||
proto = target;
|
||||
}
|
||||
var delegateName = zoneSymbol(name);
|
||||
var delegate = null;
|
||||
var delegate;
|
||||
if (proto && !(delegate = proto[delegateName])) {
|
||||
delegate = proto[delegateName] = proto[name];
|
||||
// check whether proto[name] is writable
|
||||
|
|
@ -3914,9 +3739,6 @@ function patchMethod(target, name, patchFn) {
|
|||
return patchDelegate_1(this, arguments);
|
||||
};
|
||||
attachOriginToPatched(proto[name], delegate);
|
||||
if (shouldCopySymbolProperties) {
|
||||
copySymbolProperties(delegate, proto[name]);
|
||||
}
|
||||
}
|
||||
}
|
||||
return delegate;
|
||||
|
|
@ -3935,7 +3757,7 @@ function patchMacroTask(obj, funcName, metaCreator) {
|
|||
setNative = patchMethod(obj, funcName, function (delegate) { return function (self, args) {
|
||||
var meta = metaCreator(self, args);
|
||||
if (meta.cbIdx >= 0 && typeof args[meta.cbIdx] === 'function') {
|
||||
return scheduleMacroTaskWithCurrentZone(meta.name, args[meta.cbIdx], meta, scheduleTask);
|
||||
return scheduleMacroTaskWithCurrentZone(meta.name, args[meta.cbIdx], meta, scheduleTask, null);
|
||||
}
|
||||
else {
|
||||
// cause an error by calling it directly.
|
||||
|
|
@ -3949,17 +3771,6 @@ function attachOriginToPatched(patched, original) {
|
|||
}
|
||||
var isDetectedIEOrEdge = false;
|
||||
var ieOrEdge = false;
|
||||
function isIE() {
|
||||
try {
|
||||
var ua = internalWindow.navigator.userAgent;
|
||||
if (ua.indexOf('MSIE ') !== -1 || ua.indexOf('Trident/') !== -1) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
catch (error) {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function isIEOrEdge() {
|
||||
if (isDetectedIEOrEdge) {
|
||||
return ieOrEdge;
|
||||
|
|
@ -4041,21 +3852,6 @@ Zone.__load_patch('toString', function (global) {
|
|||
* @fileoverview
|
||||
* @suppress {missingRequire}
|
||||
*/
|
||||
var passiveSupported = false;
|
||||
if (typeof window !== 'undefined') {
|
||||
try {
|
||||
var options = Object.defineProperty({}, 'passive', {
|
||||
get: function () {
|
||||
passiveSupported = true;
|
||||
}
|
||||
});
|
||||
window.addEventListener('test', options, options);
|
||||
window.removeEventListener('test', options, options);
|
||||
}
|
||||
catch (err) {
|
||||
passiveSupported = false;
|
||||
}
|
||||
}
|
||||
// an identifier to tell ZoneTask do not create a new invoke closure
|
||||
var OPTIMIZED_ZONE_EVENT_TASK_DATA = {
|
||||
useG: true
|
||||
|
|
@ -4191,7 +3987,6 @@ function patchEventTarget(_global, apis, patchOptions) {
|
|||
if (proto[zoneSymbolAddEventListener]) {
|
||||
return false;
|
||||
}
|
||||
var eventNameToString = patchOptions && patchOptions.eventNameToString;
|
||||
// a shared global taskData to pass data for scheduleEventTask
|
||||
// so we do not need to create a new object just for pass some data
|
||||
var taskData = {};
|
||||
|
|
@ -4207,24 +4002,12 @@ function patchEventTarget(_global, apis, patchOptions) {
|
|||
nativePrependEventListener = proto[zoneSymbol(patchOptions.prepend)] =
|
||||
proto[patchOptions.prepend];
|
||||
}
|
||||
function checkIsPassive(task) {
|
||||
if (!passiveSupported && typeof taskData.options !== 'boolean' &&
|
||||
typeof taskData.options !== 'undefined' && taskData.options !== null) {
|
||||
// options is a non-null non-undefined object
|
||||
// passive is not supported
|
||||
// don't pass options as object
|
||||
// just pass capture as a boolean
|
||||
task.options = !!taskData.options.capture;
|
||||
taskData.options = task.options;
|
||||
}
|
||||
}
|
||||
var customScheduleGlobal = function (task) {
|
||||
var customScheduleGlobal = function () {
|
||||
// if there is already a task for the eventName + capture,
|
||||
// just return, because we use the shared globalZoneAwareCallback here.
|
||||
if (taskData.isExisting) {
|
||||
return;
|
||||
}
|
||||
checkIsPassive(task);
|
||||
return nativeAddEventListener.call(taskData.target, taskData.eventName, taskData.capture ? globalZoneAwareCaptureCallback : globalZoneAwareCallback, taskData.options);
|
||||
};
|
||||
var customCancelGlobal = function (task) {
|
||||
|
|
@ -4265,7 +4048,6 @@ function patchEventTarget(_global, apis, patchOptions) {
|
|||
return nativeRemoveEventListener.call(task.target, task.eventName, task.capture ? globalZoneAwareCaptureCallback : globalZoneAwareCallback, task.options);
|
||||
};
|
||||
var customScheduleNonGlobal = function (task) {
|
||||
checkIsPassive(task);
|
||||
return nativeAddEventListener.call(taskData.target, taskData.eventName, task.invoke, taskData.options);
|
||||
};
|
||||
var customSchedulePrepend = function (task) {
|
||||
|
|
@ -4288,15 +4070,10 @@ function patchEventTarget(_global, apis, patchOptions) {
|
|||
if (prepend === void 0) { prepend = false; }
|
||||
return function () {
|
||||
var target = this || _global;
|
||||
var eventName = arguments[0];
|
||||
var delegate = arguments[1];
|
||||
if (!delegate) {
|
||||
return nativeListener.apply(this, arguments);
|
||||
}
|
||||
if (isNode && eventName === 'uncaughtException') {
|
||||
// don't patch uncaughtException of nodejs to prevent endless loop
|
||||
return nativeListener.apply(this, arguments);
|
||||
}
|
||||
// don't create the bind delegate function for handleEvent
|
||||
// case here to improve addEventListener performance
|
||||
// we will create the bind delegate when invoke
|
||||
|
|
@ -4310,6 +4087,7 @@ function patchEventTarget(_global, apis, patchOptions) {
|
|||
if (validateHandler && !validateHandler(nativeListener, delegate, target, arguments)) {
|
||||
return;
|
||||
}
|
||||
var eventName = arguments[0];
|
||||
var options = arguments[2];
|
||||
if (blackListedEvents) {
|
||||
// check black list
|
||||
|
|
@ -4339,8 +4117,8 @@ function patchEventTarget(_global, apis, patchOptions) {
|
|||
var symbolEventName;
|
||||
if (!symbolEventNames) {
|
||||
// the code is duplicate, but I just want to get some better performance
|
||||
var falseEventName = (eventNameToString ? eventNameToString(eventName) : eventName) + FALSE_STR;
|
||||
var trueEventName = (eventNameToString ? eventNameToString(eventName) : eventName) + TRUE_STR;
|
||||
var falseEventName = eventName + FALSE_STR;
|
||||
var trueEventName = eventName + TRUE_STR;
|
||||
var symbol = ZONE_SYMBOL_PREFIX + falseEventName;
|
||||
var symbolCapture = ZONE_SYMBOL_PREFIX + trueEventName;
|
||||
zoneSymbolEventNames$1[eventName] = {};
|
||||
|
|
@ -4375,8 +4153,7 @@ function patchEventTarget(_global, apis, patchOptions) {
|
|||
source = targetSource[eventName];
|
||||
}
|
||||
if (!source) {
|
||||
source = constructorName + addSource +
|
||||
(eventNameToString ? eventNameToString(eventName) : eventName);
|
||||
source = constructorName + addSource + eventName;
|
||||
}
|
||||
// do not create a new object as task.data to pass those things
|
||||
// just use the global shared one
|
||||
|
|
@ -4391,7 +4168,7 @@ function patchEventTarget(_global, apis, patchOptions) {
|
|||
taskData.capture = capture;
|
||||
taskData.eventName = eventName;
|
||||
taskData.isExisting = isExisting;
|
||||
var data = useGlobalCallback ? OPTIMIZED_ZONE_EVENT_TASK_DATA : undefined;
|
||||
var data = useGlobalCallback ? OPTIMIZED_ZONE_EVENT_TASK_DATA : null;
|
||||
// keep taskData into data to allow onScheduleEventTask to access the task information
|
||||
if (data) {
|
||||
data.taskData = taskData;
|
||||
|
|
@ -4409,11 +4186,7 @@ function patchEventTarget(_global, apis, patchOptions) {
|
|||
if (once) {
|
||||
options.once = true;
|
||||
}
|
||||
if (!(!passiveSupported && typeof task.options === 'boolean')) {
|
||||
// if not support passive, and we pass an option object
|
||||
// to addEventListener, we should save the options to task
|
||||
task.options = options;
|
||||
}
|
||||
task.options = options;
|
||||
task.target = target;
|
||||
task.capture = capture;
|
||||
task.eventName = eventName;
|
||||
|
|
@ -4498,7 +4271,7 @@ function patchEventTarget(_global, apis, patchOptions) {
|
|||
var target = this || _global;
|
||||
var eventName = arguments[0];
|
||||
var listeners = [];
|
||||
var tasks = findEventTasks(target, eventNameToString ? eventNameToString(eventName) : eventName);
|
||||
var tasks = findEventTasks(target, eventName);
|
||||
for (var i = 0; i < tasks.length; i++) {
|
||||
var task = tasks[i];
|
||||
var delegate = task.originalDelegate ? task.originalDelegate : task.callback;
|
||||
|
|
@ -4654,9 +4427,9 @@ function patchTimer(window, setName, cancelName, nameSuffix) {
|
|||
patchMethod(window, setName, function (delegate) { return function (self, args) {
|
||||
if (typeof args[0] === 'function') {
|
||||
var options = {
|
||||
handleId: null,
|
||||
isPeriodic: nameSuffix === 'Interval',
|
||||
delay: (nameSuffix === 'Timeout' || nameSuffix === 'Interval') ? args[1] || 0 :
|
||||
undefined,
|
||||
delay: (nameSuffix === 'Timeout' || nameSuffix === 'Interval') ? args[1] || 0 : null,
|
||||
args: args
|
||||
};
|
||||
var task = scheduleMacroTaskWithCurrentZone(setName, args[0], options, scheduleTask, clearTask);
|
||||
|
|
@ -4771,7 +4544,7 @@ function propertyPatch() {
|
|||
};
|
||||
Object.getOwnPropertyDescriptor = function (obj, prop) {
|
||||
var desc = _getOwnPropertyDescriptor(obj, prop);
|
||||
if (desc && isUnconfigurable(obj, prop)) {
|
||||
if (isUnconfigurable(obj, prop)) {
|
||||
desc.configurable = false;
|
||||
}
|
||||
return desc;
|
||||
|
|
@ -4999,10 +4772,10 @@ var globalEventHandlersEventNames = [
|
|||
'wheel'
|
||||
];
|
||||
var documentEventNames = [
|
||||
'afterscriptexecute', 'beforescriptexecute', 'DOMContentLoaded', 'freeze', 'fullscreenchange',
|
||||
'afterscriptexecute', 'beforescriptexecute', 'DOMContentLoaded', 'fullscreenchange',
|
||||
'mozfullscreenchange', 'webkitfullscreenchange', 'msfullscreenchange', 'fullscreenerror',
|
||||
'mozfullscreenerror', 'webkitfullscreenerror', 'msfullscreenerror', 'readystatechange',
|
||||
'visibilitychange', 'resume'
|
||||
'visibilitychange'
|
||||
];
|
||||
var windowEventNames = [
|
||||
'absolutedeviceorientation',
|
||||
|
|
@ -5114,7 +4887,7 @@ var websocketEventNames = ['close', 'error', 'open', 'message'];
|
|||
var workerEventNames = ['error', 'message'];
|
||||
var eventNames = globalEventHandlersEventNames.concat(webglEventNames, formEventNames, detailEventNames, documentEventNames, windowEventNames, htmlElementEventNames, ieElementEventNames);
|
||||
function filterProperties(target, onProperties, ignoreProperties) {
|
||||
if (!ignoreProperties || ignoreProperties.length === 0) {
|
||||
if (!ignoreProperties) {
|
||||
return onProperties;
|
||||
}
|
||||
var tip = ignoreProperties.filter(function (ip) { return ip.target === target; });
|
||||
|
|
@ -5139,14 +4912,13 @@ function propertyDescriptorPatch(api, _global) {
|
|||
}
|
||||
var supportsWebSocket = typeof WebSocket !== 'undefined';
|
||||
if (canPatchViaPropertyDescriptor()) {
|
||||
var ignoreProperties = _global['__Zone_ignore_on_properties'];
|
||||
var ignoreProperties = _global.__Zone_ignore_on_properties;
|
||||
// for browsers that we can patch the descriptor: Chrome & Firefox
|
||||
if (isBrowser) {
|
||||
var internalWindow = window;
|
||||
var ignoreErrorProperties = isIE ? [{ target: internalWindow, ignoreProperties: ['error'] }] : [];
|
||||
// in IE/Edge, onProp not exist in window object, but in WindowPrototype
|
||||
// so we need to pass WindowPrototype to check onProp exist or not
|
||||
patchFilteredProperties(internalWindow, eventNames.concat(['messageerror']), ignoreProperties ? ignoreProperties.concat(ignoreErrorProperties) : ignoreProperties, ObjectGetPrototypeOf(internalWindow));
|
||||
patchFilteredProperties(internalWindow, eventNames.concat(['messageerror']), ignoreProperties, ObjectGetPrototypeOf(internalWindow));
|
||||
patchFilteredProperties(Document.prototype, eventNames, ignoreProperties);
|
||||
if (typeof internalWindow['SVGElement'] !== 'undefined') {
|
||||
patchFilteredProperties(internalWindow['SVGElement'].prototype, eventNames, ignoreProperties);
|
||||
|
|
@ -5168,9 +4940,9 @@ function propertyDescriptorPatch(api, _global) {
|
|||
}
|
||||
}
|
||||
patchFilteredProperties(XMLHttpRequest.prototype, XMLHttpRequestEventNames, ignoreProperties);
|
||||
var XMLHttpRequestEventTarget_1 = _global['XMLHttpRequestEventTarget'];
|
||||
if (XMLHttpRequestEventTarget_1) {
|
||||
patchFilteredProperties(XMLHttpRequestEventTarget_1 && XMLHttpRequestEventTarget_1.prototype, XMLHttpRequestEventNames, ignoreProperties);
|
||||
var XMLHttpRequestEventTarget = _global['XMLHttpRequestEventTarget'];
|
||||
if (XMLHttpRequestEventTarget) {
|
||||
patchFilteredProperties(XMLHttpRequestEventTarget && XMLHttpRequestEventTarget.prototype, XMLHttpRequestEventNames, ignoreProperties);
|
||||
}
|
||||
if (typeof IDBIndex !== 'undefined') {
|
||||
patchFilteredProperties(IDBIndex.prototype, IDBIndexEventNames, ignoreProperties);
|
||||
|
|
@ -5385,16 +5157,16 @@ function patchEvent(global, api) {
|
|||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
function patchCallbacks(target, targetName, method, callbacks) {
|
||||
var symbol = Zone.__symbol__(method);
|
||||
if (target[symbol]) {
|
||||
function registerElementPatch(_global) {
|
||||
if ((!isBrowser && !isMix) || !('registerElement' in _global.document)) {
|
||||
return;
|
||||
}
|
||||
var nativeDelegate = target[symbol] = target[method];
|
||||
target[method] = function (name, opts, options) {
|
||||
var _registerElement = document.registerElement;
|
||||
var callbacks = ['createdCallback', 'attachedCallback', 'detachedCallback', 'attributeChangedCallback'];
|
||||
document.registerElement = function (name, opts) {
|
||||
if (opts && opts.prototype) {
|
||||
callbacks.forEach(function (callback) {
|
||||
var source = targetName + "." + method + "::" + callback;
|
||||
var source = 'Document.registerElement::' + callback;
|
||||
var prototype = opts.prototype;
|
||||
if (prototype.hasOwnProperty(callback)) {
|
||||
var descriptor = ObjectGetOwnPropertyDescriptor(prototype, callback);
|
||||
|
|
@ -5411,23 +5183,9 @@ function patchCallbacks(target, targetName, method, callbacks) {
|
|||
}
|
||||
});
|
||||
}
|
||||
return nativeDelegate.call(target, name, opts, options);
|
||||
return _registerElement.call(document, name, opts);
|
||||
};
|
||||
attachOriginToPatched(target[method], nativeDelegate);
|
||||
}
|
||||
function registerElementPatch(_global) {
|
||||
if ((!isBrowser && !isMix) || !('registerElement' in _global.document)) {
|
||||
return;
|
||||
}
|
||||
var callbacks = ['createdCallback', 'attachedCallback', 'detachedCallback', 'attributeChangedCallback'];
|
||||
patchCallbacks(document, 'Document', 'registerElement', callbacks);
|
||||
}
|
||||
function patchCustomElements(_global) {
|
||||
if ((!isBrowser && !isMix) || !('customElements' in _global)) {
|
||||
return;
|
||||
}
|
||||
var callbacks = ['connectedCallback', 'disconnectedCallback', 'adoptedCallback', 'attributeChangedCallback'];
|
||||
patchCallbacks(_global.customElements, 'customElements', 'define', callbacks);
|
||||
attachOriginToPatched(document.registerElement, _registerElement);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -5490,10 +5248,7 @@ Zone.__load_patch('EventTarget', function (global, Zone, api) {
|
|||
Zone.__load_patch('on_property', function (global, Zone, api) {
|
||||
propertyDescriptorPatch(api, global);
|
||||
propertyPatch();
|
||||
});
|
||||
Zone.__load_patch('customElements', function (global, Zone, api) {
|
||||
registerElementPatch(global);
|
||||
patchCustomElements(global);
|
||||
});
|
||||
Zone.__load_patch('canvas', function (global) {
|
||||
var HTMLCanvasElement = global['HTMLCanvasElement'];
|
||||
|
|
@ -5512,7 +5267,6 @@ Zone.__load_patch('XHR', function (global, Zone) {
|
|||
var XHR_LISTENER = zoneSymbol('xhrListener');
|
||||
var XHR_SCHEDULED = zoneSymbol('xhrScheduled');
|
||||
var XHR_URL = zoneSymbol('xhrURL');
|
||||
var XHR_ERROR_BEFORE_SCHEDULED = zoneSymbol('xhrErrorBeforeScheduled');
|
||||
function patchXHR(window) {
|
||||
var XMLHttpRequestPrototype = XMLHttpRequest.prototype;
|
||||
function findPendingTask(target) {
|
||||
|
|
@ -5521,9 +5275,9 @@ Zone.__load_patch('XHR', function (global, Zone) {
|
|||
var oriAddListener = XMLHttpRequestPrototype[ZONE_SYMBOL_ADD_EVENT_LISTENER];
|
||||
var oriRemoveListener = XMLHttpRequestPrototype[ZONE_SYMBOL_REMOVE_EVENT_LISTENER];
|
||||
if (!oriAddListener) {
|
||||
var XMLHttpRequestEventTarget_1 = window['XMLHttpRequestEventTarget'];
|
||||
if (XMLHttpRequestEventTarget_1) {
|
||||
var XMLHttpRequestEventTargetPrototype = XMLHttpRequestEventTarget_1.prototype;
|
||||
var XMLHttpRequestEventTarget = window['XMLHttpRequestEventTarget'];
|
||||
if (XMLHttpRequestEventTarget) {
|
||||
var XMLHttpRequestEventTargetPrototype = XMLHttpRequestEventTarget.prototype;
|
||||
oriAddListener = XMLHttpRequestEventTargetPrototype[ZONE_SYMBOL_ADD_EVENT_LISTENER];
|
||||
oriRemoveListener = XMLHttpRequestEventTargetPrototype[ZONE_SYMBOL_REMOVE_EVENT_LISTENER];
|
||||
}
|
||||
|
|
@ -5531,10 +5285,9 @@ Zone.__load_patch('XHR', function (global, Zone) {
|
|||
var READY_STATE_CHANGE = 'readystatechange';
|
||||
var SCHEDULED = 'scheduled';
|
||||
function scheduleTask(task) {
|
||||
XMLHttpRequest[XHR_SCHEDULED] = false;
|
||||
var data = task.data;
|
||||
var target = data.target;
|
||||
target[XHR_SCHEDULED] = false;
|
||||
target[XHR_ERROR_BEFORE_SCHEDULED] = false;
|
||||
// remove existing event listener
|
||||
var listener = target[XHR_LISTENER];
|
||||
if (!oriAddListener) {
|
||||
|
|
@ -5548,35 +5301,8 @@ Zone.__load_patch('XHR', function (global, Zone) {
|
|||
if (target.readyState === target.DONE) {
|
||||
// sometimes on some browsers XMLHttpRequest will fire onreadystatechange with
|
||||
// readyState=4 multiple times, so we need to check task state here
|
||||
if (!data.aborted && target[XHR_SCHEDULED] && task.state === SCHEDULED) {
|
||||
// check whether the xhr has registered onload listener
|
||||
// if that is the case, the task should invoke after all
|
||||
// onload listeners finish.
|
||||
var loadTasks = target['__zone_symbol__loadfalse'];
|
||||
if (loadTasks && loadTasks.length > 0) {
|
||||
var oriInvoke_1 = task.invoke;
|
||||
task.invoke = function () {
|
||||
// need to load the tasks again, because in other
|
||||
// load listener, they may remove themselves
|
||||
var loadTasks = target['__zone_symbol__loadfalse'];
|
||||
for (var i = 0; i < loadTasks.length; i++) {
|
||||
if (loadTasks[i] === task) {
|
||||
loadTasks.splice(i, 1);
|
||||
}
|
||||
}
|
||||
if (!data.aborted && task.state === SCHEDULED) {
|
||||
oriInvoke_1.call(task);
|
||||
}
|
||||
};
|
||||
loadTasks.push(task);
|
||||
}
|
||||
else {
|
||||
task.invoke();
|
||||
}
|
||||
}
|
||||
else if (!data.aborted && target[XHR_SCHEDULED] === false) {
|
||||
// error occurs when xhr.send()
|
||||
target[XHR_ERROR_BEFORE_SCHEDULED] = true;
|
||||
if (!data.aborted && XMLHttpRequest[XHR_SCHEDULED] && task.state === SCHEDULED) {
|
||||
task.invoke();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
@ -5586,7 +5312,7 @@ Zone.__load_patch('XHR', function (global, Zone) {
|
|||
target[XHR_TASK] = task;
|
||||
}
|
||||
sendNative.apply(target, data.args);
|
||||
target[XHR_SCHEDULED] = true;
|
||||
XMLHttpRequest[XHR_SCHEDULED] = true;
|
||||
return task;
|
||||
}
|
||||
function placeholderCallback() { }
|
||||
|
|
@ -5603,32 +5329,24 @@ Zone.__load_patch('XHR', function (global, Zone) {
|
|||
return openNative.apply(self, args);
|
||||
}; });
|
||||
var XMLHTTPREQUEST_SOURCE = 'XMLHttpRequest.send';
|
||||
var fetchTaskAborting = zoneSymbol('fetchTaskAborting');
|
||||
var fetchTaskScheduling = zoneSymbol('fetchTaskScheduling');
|
||||
var sendNative = patchMethod(XMLHttpRequestPrototype, 'send', function () { return function (self, args) {
|
||||
if (Zone.current[fetchTaskScheduling] === true) {
|
||||
// a fetch is scheduling, so we are using xhr to polyfill fetch
|
||||
// and because we already schedule macroTask for fetch, we should
|
||||
// not schedule a macroTask for xhr again
|
||||
return sendNative.apply(self, args);
|
||||
}
|
||||
if (self[XHR_SYNC]) {
|
||||
// if the XHR is sync there is no task to schedule, just execute the code.
|
||||
return sendNative.apply(self, args);
|
||||
}
|
||||
else {
|
||||
var options = { target: self, url: self[XHR_URL], isPeriodic: false, args: args, aborted: false };
|
||||
var task = scheduleMacroTaskWithCurrentZone(XMLHTTPREQUEST_SOURCE, placeholderCallback, options, scheduleTask, clearTask);
|
||||
if (self && self[XHR_ERROR_BEFORE_SCHEDULED] === true && !options.aborted &&
|
||||
task.state === SCHEDULED) {
|
||||
// xhr request throw error when send
|
||||
// we should invoke task instead of leaving a scheduled
|
||||
// pending macroTask
|
||||
task.invoke();
|
||||
}
|
||||
var options = {
|
||||
target: self,
|
||||
url: self[XHR_URL],
|
||||
isPeriodic: false,
|
||||
delay: null,
|
||||
args: args,
|
||||
aborted: false
|
||||
};
|
||||
return scheduleMacroTaskWithCurrentZone(XMLHTTPREQUEST_SOURCE, placeholderCallback, options, scheduleTask, clearTask);
|
||||
}
|
||||
}; });
|
||||
var abortNative = patchMethod(XMLHttpRequestPrototype, 'abort', function () { return function (self, args) {
|
||||
var abortNative = patchMethod(XMLHttpRequestPrototype, 'abort', function () { return function (self) {
|
||||
var task = findPendingTask(self);
|
||||
if (task && typeof task.type == 'string') {
|
||||
// If the XHR has already completed, do nothing.
|
||||
|
|
@ -5640,10 +5358,6 @@ Zone.__load_patch('XHR', function (global, Zone) {
|
|||
}
|
||||
task.zone.cancelTask(task);
|
||||
}
|
||||
else if (Zone.current[fetchTaskAborting] === true) {
|
||||
// the abort is called from fetch polyfill, we need to call native abort of XHR.
|
||||
return abortNative.apply(self, args);
|
||||
}
|
||||
// Otherwise, we are trying to abort an XHR which has not yet been sent, so there is no
|
||||
// task
|
||||
// to cancel. Do nothing.
|
||||
|
|
@ -5783,8 +5497,8 @@ __webpack_require__.r(__webpack_exports__);
|
|||
/*! no static exports found */
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
__webpack_require__(/*! D:\zano_zano\src\gui\qt-daemon\html_source\src\polyfills.ts */"./src/polyfills.ts");
|
||||
module.exports = __webpack_require__(/*! D:\zano_zano\src\gui\qt-daemon\html_source\node_modules\@angular-devkit\build-angular\src\angular-cli-files\models\jit-polyfills.js */"./node_modules/@angular-devkit/build-angular/src/angular-cli-files/models/jit-polyfills.js");
|
||||
__webpack_require__(/*! D:\Projects\Zano\src\gui\qt-daemon\html_source\src\polyfills.ts */"./src/polyfills.ts");
|
||||
module.exports = __webpack_require__(/*! D:\Projects\Zano\src\gui\qt-daemon\html_source\node_modules\@angular-devkit\build-angular\src\angular-cli-files\models\jit-polyfills.js */"./node_modules/@angular-devkit/build-angular/src/angular-cli-files/models/jit-polyfills.js");
|
||||
|
||||
|
||||
/***/ })
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -89615,22 +89615,6 @@ var NotIdle = /** @class */ (function (_super) {
|
|||
|
||||
//# sourceMappingURL=/home/travis/build/harunurhan/idlejs/src/not-idle.js.map
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "./node_modules/isarray/index.js":
|
||||
/*!***************************************!*\
|
||||
!*** ./node_modules/isarray/index.js ***!
|
||||
\***************************************/
|
||||
/*! no static exports found */
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
var toString = {}.toString;
|
||||
|
||||
module.exports = Array.isArray || function (arr) {
|
||||
return toString.call(arr) == '[object Array]';
|
||||
};
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "./node_modules/json-bignumber/node_modules/bignumber.js/bignumber.js":
|
||||
|
|
@ -94803,13 +94787,9 @@ exports.getEncodedBits = function getEncodedBits (errorCorrectionLevel, mask) {
|
|||
|
||||
var Buffer = __webpack_require__(/*! ../utils/buffer */ "./node_modules/qrcode/lib/utils/typedarray-buffer.js")
|
||||
|
||||
if(Buffer.alloc) {
|
||||
var EXP_TABLE = Buffer.alloc(512)
|
||||
var LOG_TABLE = Buffer.alloc(256)
|
||||
} else {
|
||||
var EXP_TABLE = new Buffer(512)
|
||||
var LOG_TABLE = new Buffer(256)
|
||||
}
|
||||
var EXP_TABLE = new Buffer(512)
|
||||
var LOG_TABLE = new Buffer(256)
|
||||
|
||||
/**
|
||||
* Precompute the log and anti-log tables for faster computation later
|
||||
*
|
||||
|
|
@ -95519,7 +95499,7 @@ var Version = __webpack_require__(/*! ./version */ "./node_modules/qrcode/lib/co
|
|||
var FormatInfo = __webpack_require__(/*! ./format-info */ "./node_modules/qrcode/lib/core/format-info.js")
|
||||
var Mode = __webpack_require__(/*! ./mode */ "./node_modules/qrcode/lib/core/mode.js")
|
||||
var Segments = __webpack_require__(/*! ./segments */ "./node_modules/qrcode/lib/core/segments.js")
|
||||
var isArray = __webpack_require__(/*! isarray */ "./node_modules/isarray/index.js")
|
||||
var isArray = __webpack_require__(/*! isarray */ "./node_modules/qrcode/node_modules/isarray/index.js")
|
||||
|
||||
/**
|
||||
* QRCode for JavaScript
|
||||
|
|
@ -96567,7 +96547,7 @@ var ECCode = __webpack_require__(/*! ./error-correction-code */ "./node_modules/
|
|||
var ECLevel = __webpack_require__(/*! ./error-correction-level */ "./node_modules/qrcode/lib/core/error-correction-level.js")
|
||||
var Mode = __webpack_require__(/*! ./mode */ "./node_modules/qrcode/lib/core/mode.js")
|
||||
var VersionCheck = __webpack_require__(/*! ./version-check */ "./node_modules/qrcode/lib/core/version-check.js")
|
||||
var isArray = __webpack_require__(/*! isarray */ "./node_modules/isarray/index.js")
|
||||
var isArray = __webpack_require__(/*! isarray */ "./node_modules/qrcode/node_modules/isarray/index.js")
|
||||
|
||||
// Generator polynomial used to encode version information
|
||||
var G18 = (1 << 12) | (1 << 11) | (1 << 10) | (1 << 9) | (1 << 8) | (1 << 5) | (1 << 2) | (1 << 0)
|
||||
|
|
@ -97017,7 +96997,7 @@ exports.qrToImageData = function qrToImageData (imgData, qr, opts) {
|
|||
|
||||
|
||||
|
||||
var isArray = __webpack_require__(/*! isarray */ "./node_modules/isarray/index.js")
|
||||
var isArray = __webpack_require__(/*! isarray */ "./node_modules/qrcode/node_modules/isarray/index.js")
|
||||
|
||||
function typedArraySupport () {
|
||||
// Can typed array instances be augmented?
|
||||
|
|
@ -97522,6 +97502,22 @@ Buffer.isBuffer = function isBuffer (b) {
|
|||
module.exports = Buffer
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "./node_modules/qrcode/node_modules/isarray/index.js":
|
||||
/*!***********************************************************!*\
|
||||
!*** ./node_modules/qrcode/node_modules/isarray/index.js ***!
|
||||
\***********************************************************/
|
||||
/*! no static exports found */
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
var toString = {}.toString;
|
||||
|
||||
module.exports = Array.isArray || function (arr) {
|
||||
return toString.call(arr) == '[object Array]';
|
||||
};
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "./node_modules/rxjs/_esm5/index.js":
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -7,13 +7,14 @@ import {ActivatedRoute} from '@angular/router';
|
|||
|
||||
export class TooltipDirective implements OnDestroy {
|
||||
|
||||
@HostBinding('style.cursor') cursor = 'pointer';
|
||||
@HostBinding('style.cursor') cursor;
|
||||
|
||||
@Input('tooltip') tooltipInner: any;
|
||||
@Input() placement: string;
|
||||
@Input() tooltipClass: string;
|
||||
@Input() timeout = 0;
|
||||
@Input() delay = 0;
|
||||
@Input() showWhenNoOverflow = true;
|
||||
tooltip: HTMLElement;
|
||||
|
||||
removeTooltipTimeout;
|
||||
|
|
@ -23,10 +24,13 @@ export class TooltipDirective implements OnDestroy {
|
|||
}
|
||||
|
||||
@HostListener('mouseenter') onMouseEnter() {
|
||||
if (!this.tooltip) {
|
||||
this.show();
|
||||
} else {
|
||||
this.cancelHide();
|
||||
if (this.showWhenNoOverflow || (!this.showWhenNoOverflow && this.el.nativeElement.offsetWidth < this.el.nativeElement.scrollWidth)) {
|
||||
this.cursor = 'pointer';
|
||||
if (!this.tooltip) {
|
||||
this.show();
|
||||
} else {
|
||||
this.cancelHide();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -38,7 +42,8 @@ export class TooltipDirective implements OnDestroy {
|
|||
|
||||
show() {
|
||||
this.create();
|
||||
this.setPosition();
|
||||
this.placement = this.placement === null ? 'top' : this.placement;
|
||||
this.setPosition(this.placement);
|
||||
}
|
||||
|
||||
hide() {
|
||||
|
|
@ -83,12 +88,6 @@ export class TooltipDirective implements OnDestroy {
|
|||
this.renderer.addClass(this.tooltip, classes[i]);
|
||||
}
|
||||
}
|
||||
if (this.placement !== null) {
|
||||
this.renderer.addClass(this.tooltip, 'ng-tooltip-' + this.placement);
|
||||
} else {
|
||||
this.placement = 'top';
|
||||
this.renderer.addClass(this.tooltip, 'ng-tooltip-top');
|
||||
}
|
||||
this.renderer.setStyle(this.tooltip, 'opacity', '0');
|
||||
this.renderer.setStyle(this.tooltip, '-webkit-transition', `opacity ${this.delay}ms`);
|
||||
this.renderer.setStyle(this.tooltip, '-moz-transition', `opacity ${this.delay}ms`);
|
||||
|
|
@ -99,35 +98,96 @@ export class TooltipDirective implements OnDestroy {
|
|||
}, 0);
|
||||
}
|
||||
|
||||
setPosition() {
|
||||
setPosition(placement) {
|
||||
const hostPos = this.el.nativeElement.getBoundingClientRect();
|
||||
// const scrollPos = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0;
|
||||
this.renderer.addClass(this.tooltip, 'ng-tooltip-' + placement);
|
||||
const topExit = hostPos.top - this.tooltip.getBoundingClientRect().height - parseInt(getComputedStyle(this.tooltip).marginTop, 10) < 0;
|
||||
const bottomExit = window.innerHeight < hostPos.bottom + this.tooltip.getBoundingClientRect().height + parseInt(getComputedStyle(this.tooltip).marginTop, 10);
|
||||
|
||||
if (this.placement === 'top') {
|
||||
this.renderer.setStyle(this.tooltip, 'left', hostPos.left + 'px');
|
||||
this.renderer.setStyle(this.tooltip, 'top', hostPos.top - this.tooltip.getBoundingClientRect().height + 'px');
|
||||
switch (placement) {
|
||||
case 'top':
|
||||
if (topExit) {
|
||||
this.renderer.removeClass(this.tooltip, 'ng-tooltip-' + placement);
|
||||
this.setPosition('bottom');
|
||||
return;
|
||||
} else {
|
||||
this.renderer.setStyle(this.tooltip, 'left', hostPos.left + (hostPos.right - hostPos.left) / 2 - this.tooltip.getBoundingClientRect().width / 2 + 'px');
|
||||
this.renderer.setStyle(this.tooltip, 'top', hostPos.top - this.tooltip.getBoundingClientRect().height + 'px');
|
||||
this.checkSides();
|
||||
}
|
||||
break;
|
||||
case 'top-left':
|
||||
if (topExit) {
|
||||
this.renderer.removeClass(this.tooltip, 'ng-tooltip-' + placement);
|
||||
this.setPosition('bottom-left');
|
||||
return;
|
||||
} else {
|
||||
this.renderer.setStyle(this.tooltip, 'left', hostPos.left + 'px');
|
||||
this.renderer.setStyle(this.tooltip, 'top', hostPos.top - this.tooltip.getBoundingClientRect().height + 'px');
|
||||
this.checkSides();
|
||||
}
|
||||
break;
|
||||
case 'top-right':
|
||||
if (topExit) {
|
||||
this.renderer.removeClass(this.tooltip, 'ng-tooltip-' + placement);
|
||||
this.setPosition('bottom-right');
|
||||
return;
|
||||
} else {
|
||||
this.renderer.setStyle(this.tooltip, 'left', hostPos.right - this.tooltip.offsetWidth + 'px');
|
||||
this.renderer.setStyle(this.tooltip, 'top', hostPos.top - this.tooltip.getBoundingClientRect().height + 'px');
|
||||
this.checkSides();
|
||||
}
|
||||
break;
|
||||
case 'bottom':
|
||||
if (bottomExit) {
|
||||
this.renderer.removeClass(this.tooltip, 'ng-tooltip-' + placement);
|
||||
this.setPosition('top');
|
||||
return;
|
||||
} else {
|
||||
this.renderer.setStyle(this.tooltip, 'top', hostPos.bottom + 'px');
|
||||
this.renderer.setStyle(this.tooltip, 'left', hostPos.left + (hostPos.right - hostPos.left) / 2 - this.tooltip.getBoundingClientRect().width / 2 + 'px');
|
||||
this.checkSides();
|
||||
}
|
||||
break;
|
||||
case 'bottom-left':
|
||||
if (bottomExit) {
|
||||
this.renderer.removeClass(this.tooltip, 'ng-tooltip-' + placement);
|
||||
this.setPosition('top-left');
|
||||
return;
|
||||
} else {
|
||||
this.renderer.setStyle(this.tooltip, 'top', hostPos.bottom + 'px');
|
||||
this.renderer.setStyle(this.tooltip, 'left', hostPos.left + 'px');
|
||||
this.checkSides();
|
||||
}
|
||||
break;
|
||||
case 'bottom-right':
|
||||
if (bottomExit) {
|
||||
this.renderer.removeClass(this.tooltip, 'ng-tooltip-' + placement);
|
||||
this.setPosition('top-right');
|
||||
return;
|
||||
} else {
|
||||
this.renderer.setStyle(this.tooltip, 'top', hostPos.bottom + 'px');
|
||||
this.renderer.setStyle(this.tooltip, 'left', hostPos.right - this.tooltip.offsetWidth + 'px');
|
||||
this.checkSides();
|
||||
}
|
||||
break;
|
||||
case 'left':
|
||||
this.renderer.setStyle(this.tooltip, 'top', hostPos.top + 'px');
|
||||
this.renderer.setStyle(this.tooltip, 'left', hostPos.left - this.tooltip.getBoundingClientRect().width + 'px');
|
||||
break;
|
||||
case 'right':
|
||||
this.renderer.setStyle(this.tooltip, 'top', hostPos.top + 'px');
|
||||
this.renderer.setStyle(this.tooltip, 'left', hostPos.right + 'px');
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.placement === 'bottom') {
|
||||
if (window.innerHeight < hostPos.bottom + this.tooltip.offsetHeight + parseInt(getComputedStyle(this.tooltip).marginTop, 10)) {
|
||||
this.renderer.removeClass(this.tooltip, 'ng-tooltip-bottom');
|
||||
this.renderer.addClass(this.tooltip, 'ng-tooltip-top');
|
||||
this.renderer.setStyle(this.tooltip, 'left', hostPos.left + 'px');
|
||||
this.renderer.setStyle(this.tooltip, 'top', hostPos.top - this.tooltip.getBoundingClientRect().height + 'px');
|
||||
} else {
|
||||
this.renderer.setStyle(this.tooltip, 'top', hostPos.bottom + 'px');
|
||||
this.renderer.setStyle(this.tooltip, 'left', hostPos.left + 'px');
|
||||
}
|
||||
checkSides() {
|
||||
if (this.tooltip.getBoundingClientRect().left < 0) {
|
||||
this.renderer.setStyle(this.tooltip, 'left', 0);
|
||||
}
|
||||
|
||||
if (this.placement === 'left') {
|
||||
this.renderer.setStyle(this.tooltip, 'top', hostPos.top + 'px');
|
||||
this.renderer.setStyle(this.tooltip, 'left', hostPos.left - this.tooltip.getBoundingClientRect().width + 'px');
|
||||
}
|
||||
|
||||
if (this.placement === 'right') {
|
||||
this.renderer.setStyle(this.tooltip, 'top', hostPos.top + 'px');
|
||||
this.renderer.setStyle(this.tooltip, 'left', hostPos.right + 'px');
|
||||
if (this.tooltip.getBoundingClientRect().right > window.innerWidth) {
|
||||
this.renderer.setStyle(this.tooltip, 'left', window.innerWidth - this.tooltip.getBoundingClientRect().width + 'px');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,9 +13,9 @@
|
|||
</div>
|
||||
<div class="row">
|
||||
<span class="cell label" [style.flex-basis]="sizes[0] + 'px'">{{ 'HISTORY.DETAILS.INPUTS' | translate }}</span>
|
||||
<span class="cell value" [style.flex-basis]="sizes[1] + 'px'">{{inputs.join(', ')}}</span>
|
||||
<span class="cell value" [style.flex-basis]="sizes[1] + 'px'" tooltip="{{inputs.join('\n')}}" placement="top" tooltipClass="table-tooltip" [delay]="500" [showWhenNoOverflow]="false">{{inputs.join(', ')}}</span>
|
||||
<span class="cell label" [style.flex-basis]="sizes[2] + 'px'">{{ 'HISTORY.DETAILS.OUTPUTS' | translate }}</span>
|
||||
<span class="cell value" [style.flex-basis]="sizes[3] + 'px'">{{outputs.join(', ')}}</span>
|
||||
<span class="cell value" [style.flex-basis]="sizes[3] + 'px'" tooltip="{{outputs.join('\n')}}" placement="top" tooltipClass="table-tooltip" [delay]="500" [showWhenNoOverflow]="false">{{outputs.join(', ')}}</span>
|
||||
</div>
|
||||
<div class="row">
|
||||
<span class="cell label" [style.flex-basis]="sizes[0] + 'px'">{{ 'HISTORY.DETAILS.COMMENT' | translate }}</span>
|
||||
|
|
|
|||
|
|
@ -16,17 +16,17 @@ export class TransactionDetailsComponent implements OnInit, OnDestroy {
|
|||
inputs: Array<string> = [];
|
||||
outputs: Array<string> = [];
|
||||
|
||||
constructor(private variablesService: VariablesService, private backendService: BackendService, private intToMoneyPipe: IntToMoneyPipe) {}
|
||||
constructor(public variablesService: VariablesService, private backendService: BackendService, private intToMoneyPipe: IntToMoneyPipe) {}
|
||||
|
||||
ngOnInit() {
|
||||
for (const input in this.transaction.td['rcv']) {
|
||||
if (this.transaction.td['rcv'].hasOwnProperty(input)) {
|
||||
this.inputs.push(this.intToMoneyPipe.transform(this.transaction.td['rcv'][input]));
|
||||
for (const input in this.transaction.td['spn']) {
|
||||
if (this.transaction.td['spn'].hasOwnProperty(input)) {
|
||||
this.inputs.push(this.intToMoneyPipe.transform(this.transaction.td['spn'][input]));
|
||||
}
|
||||
}
|
||||
for (const output in this.transaction.td['spn']) {
|
||||
if (this.transaction.td['spn'].hasOwnProperty(output)) {
|
||||
this.outputs.push(this.intToMoneyPipe.transform(this.transaction.td['spn'][output]));
|
||||
for (const output in this.transaction.td['rcv']) {
|
||||
if (this.transaction.td['rcv'].hasOwnProperty(output)) {
|
||||
this.outputs.push(this.intToMoneyPipe.transform(this.transaction.td['rcv'][output]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ export class Wallet {
|
|||
unlocked_balance: BigNumber;
|
||||
mined_total: number;
|
||||
tracking_hey: string;
|
||||
alias_available: boolean;
|
||||
|
||||
alias?: object;
|
||||
wakeAlias?: boolean;
|
||||
|
|
|
|||
|
|
@ -40,7 +40,6 @@ export class VariablesService {
|
|||
public currentWallet: Wallet;
|
||||
public aliases: any = [];
|
||||
public aliasesChecked: any = {};
|
||||
public aliasesUnconfirmed: any = [];
|
||||
public enableAliasSearch = false;
|
||||
|
||||
getHeightAppEvent = new BehaviorSubject(null);
|
||||
|
|
|
|||
|
|
@ -122,6 +122,7 @@ export class AppComponent implements OnInit, OnDestroy {
|
|||
wallet.balance = data.balance;
|
||||
wallet.unlocked_balance = data.unlocked_balance;
|
||||
wallet.mined_total = data.minied_total;
|
||||
wallet.alias_available = data.is_alias_operations_available;
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
@ -187,19 +188,6 @@ export class AppComponent implements OnInit, OnDestroy {
|
|||
return;
|
||||
}
|
||||
|
||||
if (this.variablesService.aliasesUnconfirmed.length) {
|
||||
let alias = false;
|
||||
for (let i = 0; i < this.variablesService.aliasesUnconfirmed.length; i++) {
|
||||
if (this.variablesService.aliasesUnconfirmed[i].tx_hash === data.ti.tx_hash) {
|
||||
alias = this.variablesService.aliasesUnconfirmed[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (alias) {
|
||||
this.variablesService.aliasesUnconfirmed.splice(this.variablesService.aliasesUnconfirmed.indexOf(alias), 1);
|
||||
}
|
||||
}
|
||||
|
||||
const wallet_id = data.wallet_id;
|
||||
const tr_info = data.ti;
|
||||
|
||||
|
|
|
|||
|
|
@ -14,10 +14,10 @@
|
|||
<form class="form-assign" [formGroup]="assignForm">
|
||||
|
||||
<div class="input-block alias-name">
|
||||
<label for="alias-name" tooltip="{{ 'ASSIGN_ALIAS.NAME.TOOLTIP' | translate }}" placement="bottom" tooltipClass="table-tooltip assign-alias-tooltip" [delay]="500">
|
||||
<label for="alias-name" tooltip="{{ 'ASSIGN_ALIAS.NAME.TOOLTIP' | translate }}" placement="bottom-left" tooltipClass="table-tooltip assign-alias-tooltip" [delay]="500">
|
||||
{{ 'ASSIGN_ALIAS.NAME.LABEL' | translate }}
|
||||
</label>
|
||||
<input type="text" id="alias-name" formControlName="name" placeholder="{{ 'ASSIGN_ALIAS.NAME.PLACEHOLDER' | translate }}">
|
||||
<input type="text" id="alias-name" formControlName="name" placeholder="{{ 'ASSIGN_ALIAS.NAME.PLACEHOLDER' | translate }}" (contextmenu)="variablesService.onContextMenu($event)">
|
||||
<div class="error-block" *ngIf="assignForm.controls['name'].invalid && (assignForm.controls['name'].dirty || assignForm.controls['name'].touched)">
|
||||
<div *ngIf="assignForm.controls['name'].errors['required']">
|
||||
{{ 'ASSIGN_ALIAS.FORM_ERRORS.NAME_REQUIRED' | translate }}
|
||||
|
|
@ -34,13 +34,18 @@
|
|||
{{ 'ASSIGN_ALIAS.FORM_ERRORS.NAME_EXISTS' | translate }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="error-block" *ngIf="notEnoughMoney">
|
||||
<div>
|
||||
{{ 'ASSIGN_ALIAS.FORM_ERRORS.NO_MONEY' | translate }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="input-block textarea">
|
||||
<label for="alias-comment" tooltip="{{ 'ASSIGN_ALIAS.COMMENT.TOOLTIP' | translate }}" placement="bottom" tooltipClass="table-tooltip assign-alias-tooltip" [delay]="500">
|
||||
<label for="alias-comment" tooltip="{{ 'ASSIGN_ALIAS.COMMENT.TOOLTIP' | translate }}" placement="bottom-left" tooltipClass="table-tooltip assign-alias-tooltip" [delay]="500">
|
||||
{{ 'ASSIGN_ALIAS.COMMENT.LABEL' | translate }}
|
||||
</label>
|
||||
<textarea id="alias-comment" formControlName="comment" placeholder="{{ 'ASSIGN_ALIAS.COMMENT.PLACEHOLDER' | translate }}"></textarea>
|
||||
<textarea id="alias-comment" formControlName="comment" placeholder="{{ 'ASSIGN_ALIAS.COMMENT.PLACEHOLDER' | translate }}" (contextmenu)="variablesService.onContextMenu($event)"></textarea>
|
||||
</div>
|
||||
|
||||
<div class="alias-cost">{{ "ASSIGN_ALIAS.COST" | translate : {value: alias.price | intToMoney, currency: variablesService.defaultCurrency} }}</div>
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import {Wallet} from '../_helpers/models/wallet.model';
|
|||
import {MoneyToIntPipe} from '../_helpers/pipes/money-to-int.pipe';
|
||||
import {IntToMoneyPipe} from '../_helpers/pipes/int-to-money.pipe';
|
||||
import BigNumber from 'bignumber.js';
|
||||
import {Subscription} from "rxjs";
|
||||
import {Subscription} from 'rxjs';
|
||||
|
||||
@Component({
|
||||
selector: 'app-assign-alias',
|
||||
|
|
@ -94,7 +94,6 @@ export class AssignAliasComponent implements OnInit, OnDestroy {
|
|||
this.alias.comment = this.assignForm.get('comment').value;
|
||||
this.backend.registerAlias(this.wallet.wallet_id, this.alias.name, this.wallet.address, this.alias.fee, this.alias.comment, this.alias.rewardOriginal, (status, data) => {
|
||||
if (status) {
|
||||
this.variablesService.aliasesUnconfirmed.push({tx_hash: data.tx_hash, name: this.alias.name});
|
||||
this.wallet.wakeAlias = true;
|
||||
this.modalService.prepareModal('info', 'ASSIGN_ALIAS.REQUEST_ADD_REG');
|
||||
this.ngZone.run(() => {
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
<i class="icon alert" *ngIf="!item.is_new"></i>
|
||||
<i class="icon new" *ngIf="item.is_new"></i>
|
||||
<i class="icon" [class.purchase]="item.is_a" [class.sell]="!item.is_a"></i>
|
||||
<span tooltip="{{ item.private_detailes.t }}" placement="top" tooltipClass="table-tooltip" [delay]="500">{{item.private_detailes.t}}</span>
|
||||
<span tooltip="{{ item.private_detailes.t }}" placement="top-left" tooltipClass="table-tooltip" [delay]="500" [showWhenNoOverflow]="false">{{item.private_detailes.t}}</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
|
|
@ -36,7 +36,7 @@
|
|||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="comment" tooltip="{{ item.private_detailes.c }}" placement="top" tooltipClass="table-tooltip" [delay]="500">
|
||||
<div class="comment" tooltip="{{ item.private_detailes.c }}" placement="top-right" tooltipClass="table-tooltip" [delay]="500">
|
||||
{{item.private_detailes.c}}
|
||||
</div>
|
||||
</td>
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
<label for="alias-comment">
|
||||
{{ 'EDIT_ALIAS.COMMENT.LABEL' | translate }}
|
||||
</label>
|
||||
<textarea id="alias-comment" [(ngModel)]="alias.comment" [ngModelOptions]="{standalone: true}" placeholder="{{ 'EDIT_ALIAS.COMMENT.PLACEHOLDER' | translate }}"></textarea>
|
||||
<textarea id="alias-comment" [(ngModel)]="alias.comment" [ngModelOptions]="{standalone: true}" placeholder="{{ 'EDIT_ALIAS.COMMENT.PLACEHOLDER' | translate }}" (contextmenu)="variablesService.onContextMenu($event)"></textarea>
|
||||
<div class="error-block" *ngIf="alias.comment.length > 0 && notEnoughMoney">
|
||||
{{ 'EDIT_ALIAS.FORM_ERRORS.NO_MONEY' | translate }}
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
import {Component, NgZone, OnInit} from '@angular/core';
|
||||
import {Location} from '@angular/common';
|
||||
import {Router} from '@angular/router';
|
||||
import {BackendService} from "../_helpers/services/backend.service";
|
||||
import {VariablesService} from "../_helpers/services/variables.service";
|
||||
import {BackendService} from '../_helpers/services/backend.service';
|
||||
import {VariablesService} from '../_helpers/services/variables.service';
|
||||
import {ModalService} from '../_helpers/services/modal.service';
|
||||
import {Wallet} from "../_helpers/models/wallet.model";
|
||||
import {Wallet} from '../_helpers/models/wallet.model';
|
||||
|
||||
@Component({
|
||||
selector: 'app-edit-alias',
|
||||
|
|
@ -15,7 +15,7 @@ export class EditAliasComponent implements OnInit {
|
|||
|
||||
wallet: Wallet;
|
||||
alias: any;
|
||||
oldAliasComment: 'string';
|
||||
oldAliasComment: string;
|
||||
notEnoughMoney: boolean;
|
||||
requestProcessing = false;
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
<td>
|
||||
<div class="status" [class.send]="!item.is_income" [class.received]="item.is_income">
|
||||
<ng-container *ngIf="variablesService.height_app - item.height < 10 || item.height === 0 && item.timestamp > 0">
|
||||
<div class="confirmation" tooltip="{{ 'HISTORY.STATUS_TOOLTIP' | translate : {'current': getHeight(item)/10, 'total': 10} }}" placement="bottom" tooltipClass="table-tooltip" [delay]="500">
|
||||
<div class="confirmation" tooltip="{{ 'HISTORY.STATUS_TOOLTIP' | translate : {'current': getHeight(item)/10, 'total': 10} }}" placement="bottom-left" tooltipClass="table-tooltip" [delay]="500">
|
||||
<div class="fill" [style.height]="getHeight(item) + '%'"></div>
|
||||
</div>
|
||||
</ng-container>
|
||||
|
|
|
|||
|
|
@ -9,12 +9,17 @@
|
|||
<span class="balance">{{wallet.balance | intToMoney : '3' }} {{variablesService.defaultCurrency}}</span>
|
||||
</div>
|
||||
<div class="sidebar-account-row account-alias">
|
||||
<span>{{wallet.alias['name']}}</span>
|
||||
<div style="display: flex; align-items: center;">
|
||||
<span>{{wallet.alias['name']}}</span>
|
||||
<ng-container *ngIf="wallet.alias['comment'] && wallet.alias['comment'].length">
|
||||
<i class="icon comment" tooltip="{{wallet.alias['comment']}}" placement="top" tooltipClass="table-tooltip" [delay]="500"></i>
|
||||
</ng-container>
|
||||
</div>
|
||||
<span>$ {{wallet.getMoneyEquivalent(variablesService.moneyEquivalent) | intToMoney | number : '1.2-2'}}</span>
|
||||
</div>
|
||||
<div class="sidebar-account-row account-staking" *ngIf="!(!wallet.loaded && variablesService.daemon_state === 2)">
|
||||
<span class="text">{{ 'SIDEBAR.ACCOUNT.STAKING' | translate }}</span>
|
||||
<app-staking-switch [(wallet_id)]="wallet.wallet_id" [(staking)]="wallet.staking"></app-staking-switch>
|
||||
<app-staking-switch [wallet_id]="wallet.wallet_id" [(staking)]="wallet.staking"></app-staking-switch>
|
||||
</div>
|
||||
<div class="sidebar-account-row account-messages" *ngIf="!(!wallet.loaded && variablesService.daemon_state === 2)">
|
||||
<span class="text">{{ 'SIDEBAR.ACCOUNT.MESSAGES' | translate }}</span>
|
||||
|
|
|
|||
|
|
@ -66,6 +66,16 @@
|
|||
font-size: 1.3rem;
|
||||
line-height: 3.4rem;
|
||||
margin-bottom: 0.7rem;
|
||||
|
||||
.icon {
|
||||
margin-left: 0.5rem;
|
||||
width: 1.2rem;
|
||||
height: 1.2rem;
|
||||
|
||||
&.comment {
|
||||
mask: url(../../assets/icons/alert.svg) no-repeat center;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&.account-staking {
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ export class SidebarComponent implements OnInit, OnDestroy {
|
|||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private variablesService: VariablesService,
|
||||
public variablesService: VariablesService,
|
||||
private ngZone: NgZone
|
||||
) {}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
<div>
|
||||
<span class="label">{{ 'STAKING.TITLE' | translate }}</span>
|
||||
<span class="value">
|
||||
<app-staking-switch [(wallet_id)]="variablesService.currentWallet.wallet_id" [(staking)]="variablesService.currentWallet.staking"></app-staking-switch>
|
||||
<app-staking-switch [wallet_id]="variablesService.currentWallet.wallet_id" [(staking)]="variablesService.currentWallet.staking"></app-staking-switch>
|
||||
</span>
|
||||
</div>
|
||||
<div>
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@
|
|||
<label for="alias-transfer">
|
||||
{{ 'TRANSFER_ALIAS.ADDRESS.LABEL' | translate }}
|
||||
</label>
|
||||
<input type="text" id="alias-transfer" [(ngModel)]="transferAddress" [ngModelOptions]="{standalone: true}" (ngModelChange)="changeAddress()" placeholder="{{ 'TRANSFER_ALIAS.ADDRESS.PLACEHOLDER' | translate }}">
|
||||
<input type="text" id="alias-transfer" [(ngModel)]="transferAddress" [ngModelOptions]="{standalone: true}" (ngModelChange)="changeAddress()" placeholder="{{ 'TRANSFER_ALIAS.ADDRESS.PLACEHOLDER' | translate }}" (contextmenu)="variablesService.onContextMenu($event)">
|
||||
<div class="error-block" *ngIf="transferAddress.length > 0 && (transferAddressAlias || !transferAddressValid || (transferAddressValid && !permissionSend) || notEnoughMoney)">
|
||||
<div *ngIf="!transferAddressValid">
|
||||
{{ 'TRANSFER_ALIAS.FORM_ERRORS.WRONG_ADDRESS' | translate }}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
import {Component, NgZone, OnInit} from '@angular/core';
|
||||
import {Location} from "@angular/common";
|
||||
import {Router} from "@angular/router";
|
||||
import {BackendService} from "../_helpers/services/backend.service";
|
||||
import {VariablesService} from "../_helpers/services/variables.service";
|
||||
import {ModalService} from "../_helpers/services/modal.service";
|
||||
import {Wallet} from "../_helpers/models/wallet.model";
|
||||
import {Location} from '@angular/common';
|
||||
import {Router} from '@angular/router';
|
||||
import {BackendService} from '../_helpers/services/backend.service';
|
||||
import {VariablesService} from '../_helpers/services/variables.service';
|
||||
import {ModalService} from '../_helpers/services/modal.service';
|
||||
import {Wallet} from '../_helpers/models/wallet.model';
|
||||
|
||||
@Component({
|
||||
selector: 'app-transfer-alias',
|
||||
|
|
@ -49,7 +49,7 @@ export class TransferAliasComponent implements OnInit {
|
|||
if (status) {
|
||||
this.backend.getPoolInfo((statusPool, dataPool) => {
|
||||
if (dataPool.hasOwnProperty('aliases_que') && dataPool.aliases_que.length) {
|
||||
this.setStatus(!~dataPool.aliases_que.searchBy('address', this.transferAddress));
|
||||
this.setStatus(!dataPool.aliases_que.some((el) => el.address === this.transferAddress));
|
||||
} else {
|
||||
this.setStatus(status);
|
||||
}
|
||||
|
|
@ -63,7 +63,7 @@ export class TransferAliasComponent implements OnInit {
|
|||
setStatus(statusSet) {
|
||||
this.permissionSend = statusSet;
|
||||
if (statusSet) {
|
||||
this.backend.getAliasByAddress(this.transferAddress, (status, data) => {
|
||||
this.backend.getAliasByAddress(this.transferAddress, (status) => {
|
||||
this.ngZone.run(() => {
|
||||
if (status) {
|
||||
this.transferAddressAlias = true;
|
||||
|
|
|
|||
|
|
@ -2,14 +2,16 @@
|
|||
<div>
|
||||
<h3>{{variablesService.currentWallet.name}}</h3>
|
||||
<!--<button (click)="openInBrowser('docs.zano.org/docs/how-to-get-alias')">-->
|
||||
<button [routerLink]="['/assign-alias']" *ngIf="!variablesService.currentWallet.alias.hasOwnProperty('name')">
|
||||
<button [routerLink]="['/assign-alias']" *ngIf="!variablesService.currentWallet.alias.hasOwnProperty('name') && variablesService.currentWallet.loaded && variablesService.daemon_state === 2 && variablesService.currentWallet.alias_available">
|
||||
<i class="icon account"></i>
|
||||
<span>{{ 'WALLET.REGISTER_ALIAS' | translate }}</span>
|
||||
</button>
|
||||
<div class="alias" *ngIf="variablesService.currentWallet.alias.hasOwnProperty('name')">
|
||||
<div class="alias" *ngIf="variablesService.currentWallet.alias.hasOwnProperty('name') && variablesService.currentWallet.loaded && variablesService.daemon_state === 2">
|
||||
<span>{{variablesService.currentWallet.alias['name']}}</span>
|
||||
<i class="icon edit" [routerLink]="['/edit-alias']"></i>
|
||||
<i class="icon transfer" [routerLink]="['/transfer-alias']"></i>
|
||||
<ng-container *ngIf="variablesService.currentWallet.alias_available">
|
||||
<i class="icon edit" [routerLink]="['/edit-alias']"></i>
|
||||
<i class="icon transfer" [routerLink]="['/transfer-alias']"></i>
|
||||
</ng-container>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
|
|
|
|||
|
|
@ -166,10 +166,11 @@
|
|||
"BUTTON_ASSIGN": "Assign",
|
||||
"BUTTON_CANCEL": "Cancel",
|
||||
"FORM_ERRORS": {
|
||||
"NAME_REQUIRED": "Name is required.",
|
||||
"NAME_WRONG": "Alias has wrong name.",
|
||||
"NAME_LENGTH": "The alias must be 6-25 characters long.",
|
||||
"NAME_EXISTS": "Alias name already exists."
|
||||
"NAME_REQUIRED": "Name is required",
|
||||
"NAME_WRONG": "Alias has wrong name",
|
||||
"NAME_LENGTH": "The alias must be 6-25 characters long",
|
||||
"NAME_EXISTS": "Alias name already exists",
|
||||
"NO_MONEY": "You do not have enough funds to assign this alias"
|
||||
},
|
||||
"ONE_ALIAS": "You can create only one alias per wallet",
|
||||
"REQUEST_ADD_REG": "The alias will be assigned within 10 minutes"
|
||||
|
|
|
|||
|
|
@ -310,6 +310,7 @@ input[type='checkbox'].style-checkbox {
|
|||
.table-tooltip {
|
||||
font-size: 1.3rem;
|
||||
padding: 1rem 2rem;
|
||||
white-space: pre-wrap;
|
||||
|
||||
@include themify($themes) {
|
||||
background: themed(tooltipBackgroundColor);
|
||||
|
|
@ -320,6 +321,23 @@ input[type='checkbox'].style-checkbox {
|
|||
&.ng-tooltip-top {
|
||||
margin-top: -1rem;
|
||||
|
||||
&:before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
bottom: -2rem;
|
||||
left: calc(50% - 1rem);
|
||||
border-width: 1rem;
|
||||
border-style: solid;
|
||||
|
||||
@include themify($themes) {
|
||||
border-color: themed(tooltipBackgroundColor) transparent transparent transparent;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&.ng-tooltip-top-left {
|
||||
margin-top: -1rem;
|
||||
|
||||
&:before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
|
|
@ -334,19 +352,70 @@ input[type='checkbox'].style-checkbox {
|
|||
}
|
||||
}
|
||||
|
||||
&.ng-tooltip-top-right {
|
||||
margin-top: -1rem;
|
||||
|
||||
&:before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
bottom: -1rem;
|
||||
right: 0.7rem;
|
||||
border-width: 0.5rem;
|
||||
border-style: solid;
|
||||
|
||||
@include themify($themes) {
|
||||
border-color: themed(tooltipBackgroundColor) themed(tooltipBackgroundColor) transparent transparent;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&.ng-tooltip-bottom {
|
||||
margin-top: 1rem;
|
||||
|
||||
&:before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
top: -2rem;
|
||||
left: calc(50% - 1rem);
|
||||
border-width: 1rem;
|
||||
border-style: solid;
|
||||
|
||||
@include themify($themes) {
|
||||
border-color: transparent transparent themed(tooltipBackgroundColor) transparent;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&.ng-tooltip-bottom-left {
|
||||
margin-top: 1rem;
|
||||
|
||||
&:before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
top: -1rem;
|
||||
left: 0.7rem;
|
||||
border-width: 1rem 0 0 1rem;
|
||||
border-width: 0.5rem;
|
||||
border-style: solid;
|
||||
|
||||
@include themify($themes) {
|
||||
border-color: transparent transparent transparent themed(tooltipBackgroundColor);
|
||||
border-color: transparent transparent themed(tooltipBackgroundColor) themed(tooltipBackgroundColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&.ng-tooltip-bottom-right {
|
||||
margin-top: 1rem;
|
||||
|
||||
&:before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
top: -1rem;
|
||||
right: 0.7rem;
|
||||
border-width: 0.5rem;
|
||||
border-style: solid;
|
||||
|
||||
@include themify($themes) {
|
||||
border-color: transparent themed(tooltipBackgroundColor) themed(tooltipBackgroundColor) transparent;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,6 +41,13 @@ app-sidebar {
|
|||
}
|
||||
}
|
||||
|
||||
.icon {
|
||||
|
||||
@include themify($themes) {
|
||||
background-color: themed(blueTextColor);
|
||||
}
|
||||
}
|
||||
|
||||
.indicator {
|
||||
|
||||
@include themify($themes) {
|
||||
|
|
|
|||
|
|
@ -1401,7 +1401,7 @@ int main(int argc, char* argv[])
|
|||
bool r = wrpc.init(vm);
|
||||
CHECK_AND_ASSERT_MES(r, 1, "Failed to initialize wallet rpc server");
|
||||
|
||||
tools::signal_handler::install([&wrpc, &wal] {
|
||||
tools::signal_handler::install([&wrpc/*, &wal*/ /* TODO(unassigned): use? */] {
|
||||
wrpc.send_stop_signal();
|
||||
});
|
||||
LOG_PRINT_L0("Starting wallet rpc server");
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ namespace currency
|
|||
/************************************************************************/
|
||||
/* */
|
||||
/************************************************************************/
|
||||
class simple_wallet : public tools::i_wallet2_callback,
|
||||
class simple_wallet final : public tools::i_wallet2_callback,
|
||||
public std::enable_shared_from_this<simple_wallet>
|
||||
{
|
||||
public:
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
namespace tools
|
||||
{
|
||||
class default_http_core_proxy: public i_core_proxy
|
||||
class default_http_core_proxy final : public i_core_proxy
|
||||
{
|
||||
public:
|
||||
|
||||
|
|
|
|||
|
|
@ -16,6 +16,8 @@ namespace tools
|
|||
*/
|
||||
struct i_core_proxy
|
||||
{
|
||||
virtual ~i_core_proxy() = default;
|
||||
|
||||
virtual bool set_connection_addr(const std::string& url){ return false; }
|
||||
virtual bool call_COMMAND_RPC_GET_TX_GLOBAL_OUTPUTS_INDEXES(const currency::COMMAND_RPC_GET_TX_GLOBAL_OUTPUTS_INDEXES::request& rqt, currency::COMMAND_RPC_GET_TX_GLOBAL_OUTPUTS_INDEXES::response& rsp){ return false; }
|
||||
virtual bool call_COMMAND_RPC_GET_BLOCKS_FAST(const currency::COMMAND_RPC_GET_BLOCKS_FAST::request& rqt, currency::COMMAND_RPC_GET_BLOCKS_FAST::response& rsp){ return false; }
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@
|
|||
using namespace epee;
|
||||
|
||||
#include "string_coding.h"
|
||||
#define KEEP_WALLET_LOG_MACROS
|
||||
#include "wallet2.h"
|
||||
#include "currency_core/currency_format_utils.h"
|
||||
#include "currency_core/bc_offers_service_basic.h"
|
||||
|
|
@ -33,19 +34,19 @@ ENABLE_CHANNEL_BY_DEFAULT("wallet")
|
|||
namespace tools
|
||||
{
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
void fill_transfer_details(const currency::transaction& tx, const tools::money_transfer2_details& td, tools::wallet_rpc::wallet_transfer_info_details& res_td)
|
||||
void wallet2::fill_transfer_details(const currency::transaction& tx, const tools::money_transfer2_details& td, tools::wallet_rpc::wallet_transfer_info_details& res_td) const
|
||||
{
|
||||
PROFILE_FUNC("wallet2::fill_transfer_details");
|
||||
for (auto si : td.spent_indices)
|
||||
{
|
||||
CHECK_AND_ASSERT_MES(si < tx.vin.size(), void(), "Internal error: wrong tx transfer details: spend index=" << si << " is greater than transaction inputs vector " << tx.vin.size());
|
||||
WLT_CHECK_AND_ASSERT_MES(si < tx.vin.size(), void(), "Internal error: wrong tx transfer details: spend index=" << si << " is greater than transaction inputs vector " << tx.vin.size());
|
||||
if (tx.vin[si].type() == typeid(currency::txin_to_key))
|
||||
res_td.spn.push_back(boost::get<currency::txin_to_key>(tx.vin[si]).amount);
|
||||
}
|
||||
|
||||
for (auto ri : td.receive_indices)
|
||||
{
|
||||
CHECK_AND_ASSERT_MES(ri < tx.vout.size(), void(), "Internal error: wrong tx transfer details: reciev index=" << ri << " is greater than transaction outputs vector " << tx.vout.size());
|
||||
WLT_CHECK_AND_ASSERT_MES(ri < tx.vout.size(), void(), "Internal error: wrong tx transfer details: reciev index=" << ri << " is greater than transaction outputs vector " << tx.vout.size());
|
||||
if (tx.vout[ri].target.type() == typeid(currency::txout_to_key))
|
||||
res_td.rcv.push_back(tx.vout[ri].amount);
|
||||
}
|
||||
|
|
@ -117,7 +118,7 @@ bool wallet2::get_transfer_info_by_key_image(const crypto::key_image& ki, transf
|
|||
//----------------------------------------------------------------------------------------------------
|
||||
bool wallet2::get_transfer_info_by_index(size_t i, transfer_details& td)
|
||||
{
|
||||
CHECK_AND_ASSERT_MES(i < m_transfers.size(), false, "wrong out in transaction: internal index, m_transfers.size()=" << m_transfers.size());
|
||||
WLT_CHECK_AND_ASSERT_MES(i < m_transfers.size(), false, "wrong out in transaction: internal index, m_transfers.size()=" << m_transfers.size());
|
||||
td = m_transfers[i];
|
||||
return true;
|
||||
}
|
||||
|
|
@ -157,7 +158,7 @@ size_t wallet2::fix_collisions()
|
|||
{
|
||||
m_transfers[*it].m_flags |= WALLET_TRANSFER_DETAIL_FLAG_SPENT;
|
||||
m_transfers[*it].m_spent_height = *rsp_ki.images_stat.begin();
|
||||
LOG_PRINT_L0("Fixed collision for key image " << coll_entry.first << " transfer " << count);
|
||||
WLT_LOG_L0("Fixed collision for key image " << coll_entry.first << " transfer " << count);
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
|
@ -220,7 +221,7 @@ void wallet2::process_new_transaction(const currency::transaction& tx, uint64_t
|
|||
is_derived_from_coinbase = true;
|
||||
else
|
||||
is_derived_from_coinbase = false;
|
||||
LOG_PRINT_L0("Spent key out, transfer #" << it->second << ", amount: " << print_money(m_transfers[it->second].amount()) << ", with tx: " << get_transaction_hash(tx) << ", at height " << height <<
|
||||
WLT_LOG_L0("Spent key out, transfer #" << it->second << ", amount: " << print_money(m_transfers[it->second].amount()) << ", with tx: " << get_transaction_hash(tx) << ", at height " << height <<
|
||||
"; flags: " << flags_before << " -> " << td.m_flags);
|
||||
mtd.spent_indices.push_back(i);
|
||||
remove_transfer_from_expiration_list(it->second);
|
||||
|
|
@ -234,7 +235,7 @@ void wallet2::process_new_transaction(const currency::transaction& tx, uint64_t
|
|||
{
|
||||
it->second.m_flags |= WALLET_TRANSFER_DETAIL_FLAG_SPENT;
|
||||
it->second.m_spent_height = height;
|
||||
LOG_PRINT_L0("Spent multisig out: " << multisig_id << ", amount: " << print_money(currency::get_amount_from_variant(in)) << ", with tx: " << get_transaction_hash(tx) << ", at height " << height);
|
||||
WLT_LOG_L0("Spent multisig out: " << multisig_id << ", amount: " << print_money(currency::get_amount_from_variant(in)) << ", with tx: " << get_transaction_hash(tx) << ", at height " << height);
|
||||
mtd.spent_indices.push_back(i);
|
||||
}
|
||||
}
|
||||
|
|
@ -286,7 +287,7 @@ void wallet2::process_new_transaction(const currency::transaction& tx, uint64_t
|
|||
{
|
||||
THROW_IF_TRUE_WALLET_EX(it->second >= m_transfers.size(), error::wallet_internal_error, "m_key_images entry has wrong m_transfers index, it->second: " + epee::string_tools::num_to_string_fast(it->second) + ", m_transfers.size(): " + epee::string_tools::num_to_string_fast(m_transfers.size()));
|
||||
const transfer_details& local_td = m_transfers[it->second];
|
||||
LOG_PRINT_YELLOW("tx " << get_transaction_hash(tx) << " @ block " << height << " has output #" << o << " with key image " << ki << " that has already been seen in output #" <<
|
||||
WLT_LOG_YELLOW("tx " << get_transaction_hash(tx) << " @ block " << height << " has output #" << o << " with key image " << ki << " that has already been seen in output #" <<
|
||||
local_td.m_internal_output_index << " in tx " << get_transaction_hash(local_td.m_ptx_wallet_info->m_tx) << " @ block " << local_td.m_spent_height <<
|
||||
". This output can't ever be spent and will be skipped.", LOG_LEVEL_0);
|
||||
THROW_IF_TRUE_WALLET_EX(tx_money_got_in_outs < tx.vout[o].amount, error::wallet_internal_error, "tx_money_got_in_outs: " + epee::string_tools::num_to_string_fast(tx_money_got_in_outs) + ", tx.vout[o].amount:" + print_money(tx.vout[o].amount));
|
||||
|
|
@ -315,17 +316,17 @@ void wallet2::process_new_transaction(const currency::transaction& tx, uint64_t
|
|||
size_t transfer_index = m_transfers.size()-1;
|
||||
m_key_images[td.m_key_image] = transfer_index;
|
||||
add_transfer_to_transfers_cache(tx.vout[o].amount, transfer_index);
|
||||
LOG_PRINT_L0("Received money, transfer #" << transfer_index << ", amount: " << print_money(td.amount()) << ", with tx: " << get_transaction_hash(tx) << ", at height " << height);
|
||||
WLT_LOG_L0("Received money, transfer #" << transfer_index << ", amount: " << print_money(td.amount()) << ", with tx: " << get_transaction_hash(tx) << ", at height " << height);
|
||||
}
|
||||
else if (tx.vout[o].target.type() == typeid(txout_multisig))
|
||||
{
|
||||
crypto::hash multisig_id = currency::get_multisig_out_id(tx, o);
|
||||
CHECK_AND_ASSERT_MES_NO_RET(m_multisig_transfers.count(multisig_id) == 0, "multisig_id = " << multisig_id << " already in multisig container");
|
||||
WLT_CHECK_AND_ASSERT_MES_NO_RET(m_multisig_transfers.count(multisig_id) == 0, "multisig_id = " << multisig_id << " already in multisig container");
|
||||
transfer_details_base& tdb = m_multisig_transfers[multisig_id];
|
||||
tdb.m_ptx_wallet_info = pwallet_info;
|
||||
tdb.m_internal_output_index = o;
|
||||
tdb.m_flags &= ~(WALLET_TRANSFER_DETAIL_FLAG_SPENT);
|
||||
LOG_PRINT_L0("Received multisig, multisig out id: " << multisig_id << ", amount: " << tdb.amount() << ", with tx: " << get_transaction_hash(tx));
|
||||
WLT_LOG_L0("Received multisig, multisig out id: " << multisig_id << ", amount: " << tdb.amount() << ", with tx: " << get_transaction_hash(tx));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -342,7 +343,7 @@ void wallet2::process_new_transaction(const currency::transaction& tx, uint64_t
|
|||
payment.m_block_height = height;
|
||||
payment.m_unlock_time = currency::get_tx_unlock_time(tx);
|
||||
m_payments.emplace(payment_id, payment);
|
||||
LOG_PRINT_L2("Payment found, id (hex): " << epee::string_tools::buff_to_hex_nodelimer(payment_id) << ", tx: " << payment.m_tx_hash << ", amount: " << print_money_brief(payment.m_amount));
|
||||
WLT_LOG_L2("Payment found, id (hex): " << epee::string_tools::buff_to_hex_nodelimer(payment_id) << ", tx: " << payment.m_tx_hash << ", amount: " << print_money_brief(payment.m_amount));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -357,7 +358,7 @@ void wallet2::process_new_transaction(const currency::transaction& tx, uint64_t
|
|||
{//strange transfer, seems that in one transaction have transfers from different wallets.
|
||||
if (!is_coinbase(tx))
|
||||
{
|
||||
LOG_PRINT_RED_L0("Unusual transaction " << currency::get_transaction_hash(tx) << ", tx_money_spent_in_ins: " << tx_money_spent_in_ins << ", tx_money_got_in_outs: " << tx_money_got_in_outs);
|
||||
WLT_LOG_RED("Unusual transaction " << currency::get_transaction_hash(tx) << ", tx_money_spent_in_ins: " << tx_money_spent_in_ins << ", tx_money_got_in_outs: " << tx_money_got_in_outs, LOG_LEVEL_0);
|
||||
}
|
||||
handle_money_received2(b, tx, (tx_money_got_in_outs - (tx_money_spent_in_ins - get_tx_fee(tx))), mtd);
|
||||
}
|
||||
|
|
@ -412,17 +413,17 @@ void wallet2::resend_unconfirmed()
|
|||
for (auto& ut : m_unconfirmed_txs)
|
||||
{
|
||||
req.txs_as_hex.push_back(epee::string_tools::buff_to_hex_nodelimer(tx_to_blob(ut.second.tx)));
|
||||
LOG_PRINT_GREEN("Relaying tx: " << ut.second.tx_hash, LOG_LEVEL_0);
|
||||
WLT_LOG_GREEN("Relaying tx: " << ut.second.tx_hash, LOG_LEVEL_0);
|
||||
}
|
||||
|
||||
if (!req.txs_as_hex.size())
|
||||
return;
|
||||
|
||||
bool r = m_core_proxy->call_COMMAND_RPC_FORCE_RELAY_RAW_TXS(req, res);
|
||||
CHECK_AND_ASSERT_MES(r, void(), "wrong result at call_COMMAND_RPC_FORCE_RELAY_RAW_TXS");
|
||||
CHECK_AND_ASSERT_MES(res.status == CORE_RPC_STATUS_OK, void(), "wrong result at call_COMMAND_RPC_FORCE_RELAY_RAW_TXS: status != OK, status=" << res.status);
|
||||
WLT_CHECK_AND_ASSERT_MES(r, void(), "wrong result at call_COMMAND_RPC_FORCE_RELAY_RAW_TXS");
|
||||
WLT_CHECK_AND_ASSERT_MES(res.status == CORE_RPC_STATUS_OK, void(), "wrong result at call_COMMAND_RPC_FORCE_RELAY_RAW_TXS: status != OK, status=" << res.status);
|
||||
|
||||
LOG_PRINT_GREEN("Relayed " << req.txs_as_hex.size() << " txs", LOG_LEVEL_0);
|
||||
WLT_LOG_GREEN("Relayed " << req.txs_as_hex.size() << " txs", LOG_LEVEL_0);
|
||||
}
|
||||
//-----------------------------------------------------------------------------------------------------
|
||||
void wallet2::accept_proposal(const crypto::hash& contract_id, uint64_t b_acceptance_fee, currency::transaction* p_acceptance_tx /* = nullptr */)
|
||||
|
|
@ -570,7 +571,7 @@ void wallet2::accept_cancel_contract(const crypto::hash& contract_id, currency::
|
|||
send_transaction_to_network(tx);
|
||||
TIME_MEASURE_FINISH_MS(timing3);
|
||||
if (timing1 + timing2 + timing1 > 500)
|
||||
LOG_PRINT_RED_L0("[wallet2::accept_cancel_contract] LOW PERFORMANCE: " << timing1 << "," << timing2 << "," << timing1);
|
||||
WLT_LOG_RED("[wallet2::accept_cancel_contract] LOW PERFORMANCE: " << timing1 << "," << timing2 << "," << timing1, LOG_LEVEL_0);
|
||||
|
||||
if (p_cancellation_acceptance_tx != nullptr)
|
||||
*p_cancellation_acceptance_tx = tx;
|
||||
|
|
@ -639,18 +640,18 @@ void wallet2::scan_tx_to_key_inputs(std::vector<uint64_t>& found_transfers, cons
|
|||
}
|
||||
}
|
||||
//-----------------------------------------------------------------------------------------------------
|
||||
void change_contract_state(wallet_rpc::escrow_contract_details_basic& contract, uint32_t new_state, const crypto::hash& contract_id, const wallet_rpc::wallet_transfer_info& wti)
|
||||
void wallet2::change_contract_state(wallet_rpc::escrow_contract_details_basic& contract, uint32_t new_state, const crypto::hash& contract_id, const wallet_rpc::wallet_transfer_info& wti) const
|
||||
{
|
||||
LOG_PRINT_YELLOW("escrow contract STATE CHANGE (" << (contract.is_a ? "A," : "B,") << contract_id << " via tx " << get_transaction_hash(wti.tx) << ", height: " << wti.height << ") : "
|
||||
WLT_LOG_YELLOW("escrow contract STATE CHANGE (" << (contract.is_a ? "A," : "B,") << contract_id << " via tx " << get_transaction_hash(wti.tx) << ", height: " << wti.height << ") : "
|
||||
<< wallet_rpc::get_escrow_contract_state_name(contract.state) << " -> " << wallet_rpc::get_escrow_contract_state_name(new_state), LOG_LEVEL_1);
|
||||
|
||||
contract.state = new_state;
|
||||
contract.height = wti.height; // update height of last state change
|
||||
}
|
||||
//-----------------------------------------------------------------------------------------------------
|
||||
void change_contract_state(wallet_rpc::escrow_contract_details_basic& contract, uint32_t new_state, const crypto::hash& contract_id, const std::string& reason = "internal intention")
|
||||
void wallet2::change_contract_state(wallet_rpc::escrow_contract_details_basic& contract, uint32_t new_state, const crypto::hash& contract_id, const std::string& reason /*= "internal intention"*/) const
|
||||
{
|
||||
LOG_PRINT_YELLOW("escrow contract STATE CHANGE (" << (contract.is_a ? "A," : "B,") << contract_id << " " << reason << ") : "
|
||||
WLT_LOG_YELLOW("escrow contract STATE CHANGE (" << (contract.is_a ? "A," : "B,") << contract_id << " " << reason << ") : "
|
||||
<< wallet_rpc::get_escrow_contract_state_name(contract.state) << " -> " << wallet_rpc::get_escrow_contract_state_name(new_state), LOG_LEVEL_1);
|
||||
|
||||
contract.state = new_state;
|
||||
|
|
@ -694,7 +695,7 @@ bool wallet2::handle_proposal(wallet_rpc::wallet_transfer_info& wti, const bc_se
|
|||
THROW_IF_FALSE_WALLET_INT_ERR_EX(r, "Failed to lookup_acc_outs for tx: " << get_transaction_hash(prop.tx_template));
|
||||
|
||||
add_transfers_to_expiration_list(found_transfers, ed.expiration_time, tx_money_got_in_outs, wti.tx_hash);
|
||||
LOG_PRINT_GREEN("Locked " << found_transfers.size() << " transfers due to proposal " << ms_id, LOG_LEVEL_0);
|
||||
WLT_LOG_GREEN("Locked " << found_transfers.size() << " transfers due to proposal " << ms_id, LOG_LEVEL_0);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -705,11 +706,11 @@ bool wallet2::handle_release_contract(wallet_rpc::wallet_transfer_info& wti, con
|
|||
{
|
||||
PROFILE_FUNC("wallet2::handle_release_contract");
|
||||
size_t n = get_multisig_in_index(wti.tx.vin);
|
||||
CHECK_AND_ASSERT_MES(n != wti.tx.vin.size(), false, "Multisig out not found in tx template in proposal");
|
||||
WLT_CHECK_AND_ASSERT_MES(n != wti.tx.vin.size(), false, "Multisig out not found in tx template in proposal");
|
||||
crypto::hash ms_id = boost::get<txin_multisig>(wti.tx.vin[n]).multisig_out_id;
|
||||
CHECK_AND_ASSERT_MES(ms_id != null_hash, false, "Multisig out not found in tx template in proposal");
|
||||
WLT_CHECK_AND_ASSERT_MES(ms_id != null_hash, false, "Multisig out not found in tx template in proposal");
|
||||
auto it = m_contracts.find(ms_id);
|
||||
CHECK_AND_ASSERT_MES(it != m_contracts.end(), false, "Multisig out not found in tx template in proposal");
|
||||
WLT_CHECK_AND_ASSERT_MES(it != m_contracts.end(), false, "Multisig out not found in tx template in proposal");
|
||||
|
||||
if (release_instruction == BC_ESCROW_SERVICE_INSTRUCTION_RELEASE_NORMAL)
|
||||
change_contract_state(it->second, wallet_rpc::escrow_contract_details_basic::contract_released_normal, ms_id, wti);
|
||||
|
|
@ -730,7 +731,7 @@ bool wallet2::handle_release_contract(wallet_rpc::wallet_transfer_info& wti, con
|
|||
}
|
||||
else
|
||||
{
|
||||
LOG_ERROR("wrong release_instruction: " << release_instruction);
|
||||
WLT_LOG_ERROR("wrong release_instruction: " << release_instruction);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -787,13 +788,13 @@ bool wallet2::handle_cancel_proposal(wallet_rpc::wallet_transfer_info& wti, cons
|
|||
{
|
||||
PROFILE_FUNC("wallet2::handle_cancel_proposal");
|
||||
//validate cancel proposal
|
||||
CHECK_AND_ASSERT_MES(ectb.tx_cancel_template.vin.size() && ectb.tx_cancel_template.vin[0].type() == typeid(currency::txin_multisig), false, "Wrong cancel ecrow proposal");
|
||||
WLT_CHECK_AND_ASSERT_MES(ectb.tx_cancel_template.vin.size() && ectb.tx_cancel_template.vin[0].type() == typeid(currency::txin_multisig), false, "Wrong cancel ecrow proposal");
|
||||
crypto::hash contract_id = boost::get<currency::txin_multisig>(ectb.tx_cancel_template.vin[0]).multisig_out_id;
|
||||
auto it = m_contracts.find(contract_id);
|
||||
CHECK_AND_ASSERT_MES(it != m_contracts.end(), false, "Multisig out not found in tx template in proposal");
|
||||
WLT_CHECK_AND_ASSERT_MES(it != m_contracts.end(), false, "Multisig out not found in tx template in proposal");
|
||||
|
||||
bool r = validate_escrow_cancel_proposal(wti, ectb, decrypted_attach, contract_id, it->second.private_detailes, it->second.proposal.tx_template);
|
||||
CHECK_AND_ASSERT_MES(r, false, "failed to validate escrow cancel request, contract id: " << contract_id);
|
||||
WLT_CHECK_AND_ASSERT_MES(r, false, "failed to validate escrow cancel request, contract id: " << contract_id);
|
||||
|
||||
uint32_t contract_state = it->second.state;
|
||||
switch (contract_state)
|
||||
|
|
@ -810,7 +811,7 @@ bool wallet2::handle_cancel_proposal(wallet_rpc::wallet_transfer_info& wti, cons
|
|||
wti.contract.back().contract_id = contract_id;
|
||||
return true;
|
||||
default:
|
||||
LOG_PRINT_RED("handle_cancel_proposal for contract (" << (it->second.is_a ? "A," : "B,") << contract_id << " via tx " << get_transaction_hash(wti.tx) << ", height: " << wti.height << ") : " << ENDL <<
|
||||
WLT_LOG_RED("handle_cancel_proposal for contract (" << (it->second.is_a ? "A," : "B,") << contract_id << " via tx " << get_transaction_hash(wti.tx) << ", height: " << wti.height << ") : " << ENDL <<
|
||||
"incorrect state " << wallet_rpc::get_escrow_contract_state_name(it->second.state) << ", while 'contract_accepted' or 'contract_cancel_proposal_sent' was expected -- decline cancel proposal", LOG_LEVEL_1);
|
||||
}
|
||||
|
||||
|
|
@ -832,7 +833,7 @@ bool wallet2::process_contract_info(wallet_rpc::wallet_transfer_info& wti, const
|
|||
bc_services::proposal_body prop = AUTO_VAL_INIT(prop);
|
||||
if (!t_unserializable_object_from_blob(prop, sa.body))
|
||||
{
|
||||
LOG_ERROR("Failed to unpack attachment for tx: " << wti.tx_hash);
|
||||
WLT_LOG_ERROR("Failed to unpack attachment for tx: " << wti.tx_hash);
|
||||
return false;
|
||||
}
|
||||
handle_proposal(wti, prop);
|
||||
|
|
@ -843,7 +844,7 @@ bool wallet2::process_contract_info(wallet_rpc::wallet_transfer_info& wti, const
|
|||
bc_services::contract_private_details cntr = AUTO_VAL_INIT(cntr);
|
||||
if (!epee::serialization::load_t_from_json(cntr, sa.body))
|
||||
{
|
||||
LOG_ERROR("Failed to unpack attachment for tx: " << wti.tx_hash);
|
||||
WLT_LOG_ERROR("Failed to unpack attachment for tx: " << wti.tx_hash);
|
||||
return false;
|
||||
}
|
||||
handle_contract(wti, cntr, decrypted_attach);
|
||||
|
|
@ -863,7 +864,7 @@ bool wallet2::process_contract_info(wallet_rpc::wallet_transfer_info& wti, const
|
|||
bc_services::escrow_cancel_templates_body cpb = AUTO_VAL_INIT(cpb);
|
||||
if (!t_unserializable_object_from_blob(cpb, sa.body))
|
||||
{
|
||||
LOG_ERROR("Failed to unpack attachment for tx: " << wti.tx_hash);
|
||||
WLT_LOG_ERROR("Failed to unpack attachment for tx: " << wti.tx_hash);
|
||||
return false;
|
||||
}
|
||||
handle_cancel_proposal(wti, cpb, decrypted_attach);
|
||||
|
|
@ -983,10 +984,10 @@ void wallet2::process_new_blockchain_entry(const currency::block& b, const curre
|
|||
process_new_transaction(tx_entry->tx, height, b);
|
||||
}
|
||||
TIME_MEASURE_FINISH(txs_handle_time);
|
||||
LOG_PRINT_L2("Processed block: " << bl_id << ", height " << height << ", " << miner_tx_handle_time + txs_handle_time << "(" << miner_tx_handle_time << "/" << txs_handle_time <<")ms");
|
||||
WLT_LOG_L2("Processed block: " << bl_id << ", height " << height << ", " << miner_tx_handle_time + txs_handle_time << "(" << miner_tx_handle_time << "/" << txs_handle_time <<")ms");
|
||||
}else
|
||||
{
|
||||
LOG_PRINT_L2( "Skipped block by timestamp, height: " << height << ", block time " << b.timestamp << ", account time " << m_account.get_createtime());
|
||||
WLT_LOG_L2( "Skipped block by timestamp, height: " << height << ", block time " << b.timestamp << ", account time " << m_account.get_createtime());
|
||||
}
|
||||
m_blockchain.push_back(bl_id);
|
||||
++m_local_bc_height;
|
||||
|
|
@ -1033,7 +1034,7 @@ void wallet2::pull_blocks(size_t& blocks_added, std::atomic<bool>& stop)
|
|||
THROW_IF_TRUE_WALLET_EX(!r, error::no_connection_to_daemon, "getblocks.bin");
|
||||
if (res.status == CORE_RPC_STATUS_GENESIS_MISMATCH)
|
||||
{
|
||||
LOG_PRINT_MAGENTA("Reseting genesis block...", LOG_LEVEL_0);
|
||||
WLT_LOG_MAGENTA("Reseting genesis block...", LOG_LEVEL_0);
|
||||
COMMAND_RPC_GET_BLOCKS_DETAILS::request gbd_req = AUTO_VAL_INIT(gbd_req);
|
||||
COMMAND_RPC_GET_BLOCKS_DETAILS::response gbd_res = AUTO_VAL_INIT(gbd_res);
|
||||
gbd_req.height_start = 0;
|
||||
|
|
@ -1048,7 +1049,7 @@ void wallet2::pull_blocks(size_t& blocks_added, std::atomic<bool>& stop)
|
|||
THROW_IF_TRUE_WALLET_EX(!r, error::no_connection_to_daemon, "get_blocks_details");
|
||||
reset_all();
|
||||
m_blockchain.push_back(new_genesis_id);
|
||||
LOG_PRINT_MAGENTA("New genesis set for wallet: " << new_genesis_id, LOG_LEVEL_0);
|
||||
WLT_LOG_MAGENTA("New genesis set for wallet: " << new_genesis_id, LOG_LEVEL_0);
|
||||
get_short_chain_history(req.block_ids);
|
||||
//req.block_ids.push_back(new_genesis_id);
|
||||
bool r = m_core_proxy->call_COMMAND_RPC_GET_BLOCKS_DIRECT(req, res);
|
||||
|
|
@ -1056,7 +1057,7 @@ void wallet2::pull_blocks(size_t& blocks_added, std::atomic<bool>& stop)
|
|||
}
|
||||
if (res.status == CORE_RPC_STATUS_BUSY)
|
||||
{
|
||||
LOG_PRINT_L1("Core is busy, pull cancelled");
|
||||
WLT_LOG_L1("Core is busy, pull cancelled");
|
||||
stop = true;
|
||||
return;
|
||||
}
|
||||
|
|
@ -1111,7 +1112,7 @@ void wallet2::handle_pulled_blocks(size_t& blocks_added, std::atomic<bool>& stop
|
|||
}
|
||||
else
|
||||
{
|
||||
LOG_PRINT_L2("Block " << bl_id << " @ " << current_index << " is already in wallet's blockchain");
|
||||
WLT_LOG_L2("Block " << bl_id << " @ " << current_index << " is already in wallet's blockchain");
|
||||
}
|
||||
|
||||
++current_index;
|
||||
|
|
@ -1126,7 +1127,7 @@ void wallet2::handle_pulled_blocks(size_t& blocks_added, std::atomic<bool>& stop
|
|||
}
|
||||
}
|
||||
|
||||
LOG_PRINT_L1("[PULL BLOCKS] " << res.start_height << " --> " << m_blockchain.size());
|
||||
WLT_LOG_L1("[PULL BLOCKS] " << res.start_height << " --> " << m_blockchain.size());
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
void wallet2::refresh()
|
||||
|
|
@ -1303,7 +1304,7 @@ void wallet2::scan_tx_pool(bool& has_related_alias_in_unconfirmed)
|
|||
r = unconfirmed_multisig_transfers_from_tx_pool.insert(std::make_pair(multisig_id, std::make_pair(tx, td))).second;
|
||||
if (!r)
|
||||
{
|
||||
LOG_PRINT_RED_L0("Warning: Receiving the same multisig out id from tx pool more then once: " << multisig_id);
|
||||
WLT_LOG_RED("Warning: Receiving the same multisig out id from tx pool more then once: " << multisig_id, LOG_LEVEL_0);
|
||||
}
|
||||
if (m_unconfirmed_multisig_transfers.count(multisig_id) == 0)
|
||||
{
|
||||
|
|
@ -1311,7 +1312,7 @@ void wallet2::scan_tx_pool(bool& has_related_alias_in_unconfirmed)
|
|||
uint32_t flags_before = it->second.m_flags;
|
||||
it->second.m_flags |= WALLET_TRANSFER_DETAIL_FLAG_SPENT; // mark as spent
|
||||
it->second.m_spent_height = 0; // height 0 means unconfirmed
|
||||
LOG_PRINT_L0("From tx pool got new unconfirmed multisig out with id: " << multisig_id << " tx: " << get_transaction_hash(tx) << " Marked as SPENT, flags: " << flags_before << " -> " << it->second.m_flags);
|
||||
WLT_LOG_L0("From tx pool got new unconfirmed multisig out with id: " << multisig_id << " tx: " << get_transaction_hash(tx) << " Marked as SPENT, flags: " << flags_before << " -> " << it->second.m_flags);
|
||||
new_multisig_spend_detected = true;
|
||||
}
|
||||
|
||||
|
|
@ -1342,7 +1343,7 @@ void wallet2::scan_tx_pool(bool& has_related_alias_in_unconfirmed)
|
|||
uint64_t amount = 0;
|
||||
/*if (!new_multisig_spend_detected && tx_money_spent_in_ins < tx_money_got_in_outs+get_tx_fee(tx))
|
||||
{
|
||||
LOG_ERROR("Transaction that get more then send: tx_money_spent_in_ins=" << tx_money_spent_in_ins
|
||||
WLT_LOG_ERROR("Transaction that get more then send: tx_money_spent_in_ins=" << tx_money_spent_in_ins
|
||||
<< ", tx_money_got_in_outs=" << tx_money_got_in_outs << ", tx_id=" << tx_hash);
|
||||
}
|
||||
else*/ if (new_multisig_spend_detected)
|
||||
|
|
@ -1364,12 +1365,12 @@ void wallet2::scan_tx_pool(bool& has_related_alias_in_unconfirmed)
|
|||
{
|
||||
if (tr_index > m_transfers.size())
|
||||
{
|
||||
LOG_ERROR("INTERNAL ERROR: tr_index " << tr_index << " more then m_transfers.size()=" << m_transfers.size());
|
||||
WLT_LOG_ERROR("INTERNAL ERROR: tr_index " << tr_index << " more then m_transfers.size()=" << m_transfers.size());
|
||||
continue;
|
||||
}
|
||||
uint32_t flags_before = m_transfers[tr_index].m_flags;
|
||||
m_transfers[tr_index].m_flags |= WALLET_TRANSFER_DETAIL_FLAG_SPENT;
|
||||
LOG_PRINT_L1("wallet transfer #" << tr_index << " is marked as spent, flags: " << flags_before << " -> " << m_transfers[tr_index].m_flags << ", reason: UNCONFIRMED tx: " << tx_hash);
|
||||
WLT_LOG_L1("wallet transfer #" << tr_index << " is marked as spent, flags: " << flags_before << " -> " << m_transfers[tr_index].m_flags << ", reason: UNCONFIRMED tx: " << tx_hash);
|
||||
unconfirmed_wti.selected_indicies.push_back(tr_index);
|
||||
}
|
||||
rise_on_transfer2(unconfirmed_wti);
|
||||
|
|
@ -1405,7 +1406,7 @@ void wallet2::scan_tx_pool(bool& has_related_alias_in_unconfirmed)
|
|||
// So, clear spent flag.
|
||||
uint32_t flags_before = it->second.m_flags;
|
||||
it->second.m_flags &= ~(WALLET_TRANSFER_DETAIL_FLAG_SPENT);
|
||||
LOG_PRINT_L0("Unconfirmed multisig out with id: " << multisig_id << " was presiously marked as spent and now seems to be removed from the pool, while still not added to the blockchain. Marked as NOT SPENT" << ENDL
|
||||
WLT_LOG_L0("Unconfirmed multisig out with id: " << multisig_id << " was presiously marked as spent and now seems to be removed from the pool, while still not added to the blockchain. Marked as NOT SPENT" << ENDL
|
||||
<< "ms source tx: " << (it->second.m_ptx_wallet_info != nullptr ? get_transaction_hash(it->second.m_ptx_wallet_info->m_tx) : null_hash) << " flags: " << flags_before << " -> " << it->second.m_flags);
|
||||
}
|
||||
}
|
||||
|
|
@ -1432,20 +1433,20 @@ bool wallet2::scan_unconfirmed_outdate_tx()
|
|||
bool tx_outdated = it->second.timestamp < time_limit;
|
||||
if (tx_outdated || is_tx_expired(it->second.tx, tx_expiration_ts_median))
|
||||
{
|
||||
LOG_PRINT_BLUE("removing unconfirmed tx " << it->second.tx_hash << ", reason: " << (tx_outdated ? "outdated" : "expired"), LOG_LEVEL_0);
|
||||
WLT_LOG_BLUE("removing unconfirmed tx " << it->second.tx_hash << ", reason: " << (tx_outdated ? "outdated" : "expired"), LOG_LEVEL_0);
|
||||
//lookup all used transfer and update flags
|
||||
for (auto i : it->second.selected_indicies)
|
||||
{
|
||||
if (i >= m_transfers.size())
|
||||
{
|
||||
LOG_ERROR("Wrong index '" << i << "' in 'selected_indicies', while m_transfers.size() = " << m_transfers.size());
|
||||
WLT_LOG_ERROR("Wrong index '" << i << "' in 'selected_indicies', while m_transfers.size() = " << m_transfers.size());
|
||||
continue;
|
||||
}
|
||||
if (!m_transfers[i].m_spent_height)
|
||||
{
|
||||
uint32_t flags_before = m_transfers[i].m_flags;
|
||||
m_transfers[i].m_flags &= ~(WALLET_TRANSFER_DETAIL_FLAG_SPENT);
|
||||
LOG_PRINT_BLUE("mark transfer #" << i << " as unspent, flags: " << flags_before << " -> " << m_transfers[i].m_flags << ", reason: removing unconfirmed tx " << it->second.tx_hash, LOG_LEVEL_0);
|
||||
WLT_LOG_BLUE("mark transfer #" << i << " as unspent, flags: " << flags_before << " -> " << m_transfers[i].m_flags << ", reason: removing unconfirmed tx " << it->second.tx_hash, LOG_LEVEL_0);
|
||||
}
|
||||
}
|
||||
//fire some event
|
||||
|
|
@ -1483,7 +1484,7 @@ bool wallet2::scan_unconfirmed_outdate_tx()
|
|||
{
|
||||
uint32_t flags_before = t.m_flags;
|
||||
t.m_flags &= ~(WALLET_TRANSFER_DETAIL_FLAG_SPENT);
|
||||
LOG_PRINT_BLUE("Transfer [" << i << "] marked as unspent, flags: " << flags_before << " -> " << t.m_flags << ", reason: there is no unconfirmed tx relataed to this key image", LOG_LEVEL_0);
|
||||
WLT_LOG_BLUE("Transfer [" << i << "] marked as unspent, flags: " << flags_before << " -> " << t.m_flags << ", reason: there is no unconfirmed tx relataed to this key image", LOG_LEVEL_0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1515,12 +1516,12 @@ void wallet2::refresh(size_t & blocks_fetched, bool& received_money, std::atomic
|
|||
blocks_fetched += added_blocks;
|
||||
if(try_count < 3)
|
||||
{
|
||||
LOG_PRINT_L1("Another try pull_blocks (try_count=" << try_count << "), exception: " << e.what());
|
||||
WLT_LOG_L1("Another try pull_blocks (try_count=" << try_count << "), exception: " << e.what());
|
||||
++try_count;
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_ERROR("pull_blocks failed, try_count=" << try_count << ", exception: " << e.what());
|
||||
WLT_LOG_ERROR("pull_blocks failed, try_count=" << try_count << ", exception: " << e.what());
|
||||
return;
|
||||
//throw;
|
||||
}
|
||||
|
|
@ -1541,7 +1542,7 @@ void wallet2::refresh(size_t & blocks_fetched, bool& received_money, std::atomic
|
|||
}
|
||||
|
||||
|
||||
LOG_PRINT_L1("Refresh done, blocks received: " << blocks_fetched << ", balance: " << print_money(balance()) << ", unlocked: " << print_money(unlocked_balance()));
|
||||
WLT_LOG_L1("Refresh done, blocks received: " << blocks_fetched << ", balance: " << print_money(balance()) << ", unlocked: " << print_money(unlocked_balance()));
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
bool wallet2::handle_expiration_list(uint64_t tx_expiration_ts_median)
|
||||
|
|
@ -1560,12 +1561,12 @@ bool wallet2::handle_expiration_list(uint64_t tx_expiration_ts_median)
|
|||
uint32_t flags_before = transfer.m_flags;
|
||||
transfer.m_flags &= ~(WALLET_TRANSFER_DETAIL_FLAG_BLOCKED);
|
||||
transfer.m_flags &= ~(WALLET_TRANSFER_DETAIL_FLAG_ESCROW_PROPOSAL_RESERVATION);
|
||||
LOG_PRINT_GREEN("Unlocked money from expiration_list: transfer #" << tr_ind << ", flags: " << flags_before << " -> " << transfer.m_flags << ", amount: " << print_money(transfer.amount()) << ", tx: " <<
|
||||
WLT_LOG_GREEN("Unlocked money from expiration_list: transfer #" << tr_ind << ", flags: " << flags_before << " -> " << transfer.m_flags << ", amount: " << print_money(transfer.amount()) << ", tx: " <<
|
||||
(transfer.m_ptx_wallet_info != nullptr ? get_transaction_hash(transfer.m_ptx_wallet_info->m_tx) : null_hash), LOG_LEVEL_0);
|
||||
}
|
||||
|
||||
}
|
||||
LOG_PRINT_GREEN("expiration_list entry removed by median: " << tx_expiration_ts_median << ", expiration time: " << it->expiration_time << ", related tx: " << it->related_tx_id, LOG_LEVEL_0);
|
||||
WLT_LOG_GREEN("expiration_list entry removed by median: " << tx_expiration_ts_median << ", expiration time: " << it->expiration_time << ", related tx: " << it->related_tx_id, LOG_LEVEL_0);
|
||||
it = m_money_expirations.erase(it);
|
||||
}
|
||||
else
|
||||
|
|
@ -1610,7 +1611,7 @@ bool wallet2::refresh(size_t & blocks_fetched, bool& received_money, bool& ok, s
|
|||
//----------------------------------------------------------------------------------------------------
|
||||
void wallet2::detach_blockchain(uint64_t height)
|
||||
{
|
||||
LOG_PRINT_L0("Detaching blockchain on height " << height);
|
||||
WLT_LOG_L0("Detaching blockchain on height " << height);
|
||||
size_t transfers_detached = 0;
|
||||
|
||||
{
|
||||
|
|
@ -1642,7 +1643,7 @@ void wallet2::detach_blockchain(uint64_t height)
|
|||
{
|
||||
uint32_t flags_before = tr.m_flags;
|
||||
tr.m_flags &= ~(WALLET_TRANSFER_DETAIL_FLAG_SPENT);
|
||||
LOG_PRINT_BLUE("Transfer [" << i << "] marked as unspent, flags: " << flags_before << " -> " << tr.m_flags << ", reason: blockchain detach height " << height << " is lower or equal to transfer spent height " << tr.m_spent_height, LOG_LEVEL_1);
|
||||
WLT_LOG_BLUE("Transfer [" << i << "] marked as unspent, flags: " << flags_before << " -> " << tr.m_flags << ", reason: blockchain detach height " << height << " is lower or equal to transfer spent height " << tr.m_spent_height, LOG_LEVEL_1);
|
||||
tr.m_spent_height = 0;
|
||||
}
|
||||
}
|
||||
|
|
@ -1667,7 +1668,7 @@ void wallet2::detach_blockchain(uint64_t height)
|
|||
++it;
|
||||
}
|
||||
|
||||
LOG_PRINT_L0("Detached blockchain on height " << height << ", transfers detached " << transfers_detached << ", blocks detached " << blocks_detached);
|
||||
WLT_LOG_L0("Detached blockchain on height " << height << ", transfers detached " << transfers_detached << ", blocks detached " << blocks_detached);
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
bool wallet2::deinit()
|
||||
|
|
@ -1708,7 +1709,7 @@ bool wallet2::store_keys(std::string& buff, const std::string& password)
|
|||
{
|
||||
std::string account_data;
|
||||
bool r = epee::serialization::store_t_to_binary(m_account, account_data);
|
||||
CHECK_AND_ASSERT_MES(r, false, "failed to serialize wallet keys");
|
||||
WLT_CHECK_AND_ASSERT_MES(r, false, "failed to serialize wallet keys");
|
||||
wallet2::keys_file_data keys_file_data = boost::value_initialized<wallet2::keys_file_data>();
|
||||
|
||||
crypto::chacha8_key key;
|
||||
|
|
@ -1728,10 +1729,10 @@ bool wallet2::backup_keys(const std::string& path)
|
|||
{
|
||||
std::string buff;
|
||||
bool r = store_keys(buff, m_password);
|
||||
CHECK_AND_ASSERT_MES(r, false, "Failed to store keys");
|
||||
WLT_CHECK_AND_ASSERT_MES(r, false, "Failed to store keys");
|
||||
|
||||
r = file_io_utils::save_string_to_file(path, buff);
|
||||
CHECK_AND_ASSERT_MES(r, false, "Failed to save_string_to_file at store keys");
|
||||
WLT_CHECK_AND_ASSERT_MES(r, false, "Failed to save_string_to_file at store keys");
|
||||
return true;
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
|
|
@ -1777,10 +1778,11 @@ void wallet2::load_keys(const std::string& buff, const std::string& password)
|
|||
r = r && verify_keys(keys.m_spend_secret_key, keys.m_account_address.m_spend_public_key);
|
||||
if (!r)
|
||||
{
|
||||
LOG_PRINT_L0("Wrong password for wallet " << string_encoding::convert_to_ansii(m_wallet_file));
|
||||
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__)));
|
||||
}
|
||||
//THROW_IF_TRUE_WALLET_EX(!r, );
|
||||
|
||||
m_log_prefix = m_account.get_public_address_str().substr(0, 6);
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
void wallet2::assign_account(const currency::account_base& acc)
|
||||
|
|
@ -1848,7 +1850,7 @@ void wallet2::load(const std::wstring& wallet_, const std::string& password)
|
|||
data_file.read((char*)keys_buff.data(), wbh.m_cb_keys);
|
||||
|
||||
load_keys(keys_buff, password);
|
||||
LOG_PRINT_L0("Loaded wallet keys file, with public address: " << m_account.get_public_address_str());
|
||||
WLT_LOG_L0("Loaded wallet keys file, with public address: " << m_account.get_public_address_str());
|
||||
|
||||
bool r = tools::portable_unserialize_obj_from_stream(*this, data_file);
|
||||
|
||||
|
|
@ -1894,7 +1896,7 @@ void wallet2::store(const std::wstring& path_to_save)
|
|||
data_file.open(path_to_save, std::ios_base::binary | std::ios_base::out | std::ios::trunc);
|
||||
CHECK_AND_ASSERT_THROW_MES(!data_file.fail(), "failed to open binary wallet file for saving: " << epee::string_encoding::convert_to_ansii(m_wallet_file));
|
||||
data_file << header_buff << keys_buff;
|
||||
LOG_PRINT_L0("Storing to file...");
|
||||
WLT_LOG_L0("Storing to file...");
|
||||
r = tools::portble_serialize_obj_to_stream(*this, data_file);
|
||||
CHECK_AND_ASSERT_THROW_MES(r, "failed to portble_serialize_obj_to_stream for wallet " << epee::string_encoding::convert_to_ansii(m_wallet_file));
|
||||
|
||||
|
|
@ -2097,11 +2099,11 @@ bool wallet2::prepare_and_sign_pos_block(currency::block& b,
|
|||
const std::vector<const crypto::public_key*>& keys_ptrs)
|
||||
{
|
||||
//generate coinbase transaction
|
||||
CHECK_AND_ASSERT_MES(b.miner_tx.vin[0].type() == typeid(currency::txin_gen), false, "Wrong output input in transaction");
|
||||
CHECK_AND_ASSERT_MES(b.miner_tx.vin[1].type() == typeid(currency::txin_to_key), false, "Wrong output input in transaction");
|
||||
WLT_CHECK_AND_ASSERT_MES(b.miner_tx.vin[0].type() == typeid(currency::txin_gen), false, "Wrong output input in transaction");
|
||||
WLT_CHECK_AND_ASSERT_MES(b.miner_tx.vin[1].type() == typeid(currency::txin_to_key), false, "Wrong output input in transaction");
|
||||
auto& txin = boost::get<currency::txin_to_key>(b.miner_tx.vin[1]);
|
||||
txin.k_image = pos_info.keyimage;
|
||||
CHECK_AND_ASSERT_MES(b.miner_tx.signatures.size() == 1 && b.miner_tx.signatures[0].size() == txin.key_offsets.size(),
|
||||
WLT_CHECK_AND_ASSERT_MES(b.miner_tx.signatures.size() == 1 && b.miner_tx.signatures[0].size() == txin.key_offsets.size(),
|
||||
false, "Wrong signatures amount in coinbase transacton");
|
||||
|
||||
|
||||
|
|
@ -2112,7 +2114,7 @@ bool wallet2::prepare_and_sign_pos_block(currency::block& b,
|
|||
m_account.get_keys().m_view_secret_key,
|
||||
pos_coin_derivation);
|
||||
|
||||
CHECK_AND_ASSERT_MES(r, false, "internal error: pos coin base generator: failed to generate_key_derivation("
|
||||
WLT_CHECK_AND_ASSERT_MES(r, false, "internal error: pos coin base generator: failed to generate_key_derivation("
|
||||
<< source_tx_pub_key
|
||||
<< ", view secret key: " << m_account.get_keys().m_view_secret_key << ")");
|
||||
|
||||
|
|
@ -2132,7 +2134,7 @@ bool wallet2::prepare_and_sign_pos_block(currency::block& b,
|
|||
0,
|
||||
&b.miner_tx.signatures[0][0]);
|
||||
|
||||
LOG_PRINT_L4("GENERATED RING SIGNATURE: block_id " << block_hash
|
||||
WLT_LOG_L4("GENERATED RING SIGNATURE: block_id " << block_hash
|
||||
<< "txin.k_image" << txin.k_image
|
||||
<< "key_ptr:" << *keys_ptrs[0]
|
||||
<< "signature:" << b.miner_tx.signatures[0][0]);
|
||||
|
|
@ -2166,7 +2168,7 @@ bool wallet2::fill_mining_context(mining_context& ctx)
|
|||
|
||||
|
||||
bool r = get_pos_entries(ctx.sp);
|
||||
CHECK_AND_ASSERT_MES(r, false, "Failed to get_pos_entries()");
|
||||
WLT_CHECK_AND_ASSERT_MES(r, false, "Failed to get_pos_entries()");
|
||||
|
||||
currency::COMMAND_RPC_GET_POS_MINING_DETAILS::request pos_details_req = AUTO_VAL_INIT(pos_details_req);
|
||||
currency::COMMAND_RPC_GET_POS_MINING_DETAILS::response pos_details_resp = AUTO_VAL_INIT(pos_details_resp);
|
||||
|
|
@ -2186,14 +2188,14 @@ bool wallet2::fill_mining_context(mining_context& ctx)
|
|||
bool wallet2::try_mint_pos()
|
||||
{
|
||||
mining_context ctx = AUTO_VAL_INIT(ctx);
|
||||
LOG_PRINT_L0("Starting PoS mint iteration");
|
||||
WLT_LOG_L0("Starting PoS mint iteration");
|
||||
fill_mining_context(ctx);
|
||||
if (!ctx.rsp.is_pos_allowed)
|
||||
{
|
||||
LOG_PRINT_L0("POS MINING NOT ALLOWED YET");
|
||||
WLT_LOG_L0("POS MINING NOT ALLOWED YET");
|
||||
return true;
|
||||
}
|
||||
LOG_PRINT_L0("POS_ENTRIES: " << ctx.sp.pos_entries.size());
|
||||
WLT_LOG_L0("POS_ENTRIES: " << ctx.sp.pos_entries.size());
|
||||
|
||||
std::atomic<bool> stop(false);
|
||||
scan_pos(ctx, stop, [this](){
|
||||
|
|
@ -2201,7 +2203,7 @@ bool wallet2::try_mint_pos()
|
|||
refresh(blocks_fetched);
|
||||
if (blocks_fetched)
|
||||
{
|
||||
LOG_PRINT_L0("Detected new block, minting interrupted");
|
||||
WLT_LOG_L0("Detected new block, minting interrupted");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
|
@ -2211,7 +2213,7 @@ bool wallet2::try_mint_pos()
|
|||
{
|
||||
build_minted_block(ctx.sp, ctx.rsp);
|
||||
}
|
||||
LOG_PRINT_L0("PoS mint iteration finished(" << ctx.rsp.status << ")");
|
||||
WLT_LOG_L0("PoS mint iteration finished(" << ctx.rsp.status << ")");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -2243,7 +2245,7 @@ bool wallet2::build_minted_block(const currency::COMMAND_RPC_SCAN_POS::request&
|
|||
uint64_t new_block_expected_height /* UINT64_MAX */)
|
||||
{
|
||||
//found a block, construct it, sign and push to daemon
|
||||
LOG_PRINT_GREEN("Found kernel, constructing block", LOG_LEVEL_0);
|
||||
WLT_LOG_GREEN("Found kernel, constructing block", LOG_LEVEL_0);
|
||||
|
||||
CHECK_AND_NO_ASSERT_MES(rsp.index < req.pos_entries.size(), false, "call_COMMAND_RPC_SCAN_POS returned wrong index: " << rsp.index << ", expected less then " << req.pos_entries.size());
|
||||
|
||||
|
|
@ -2256,27 +2258,27 @@ bool wallet2::build_minted_block(const currency::COMMAND_RPC_SCAN_POS::request&
|
|||
tmpl_req.pos_index = req.pos_entries[rsp.index].index;
|
||||
tmpl_req.extra_text = m_miner_text_info;
|
||||
m_core_proxy->call_COMMAND_RPC_GETBLOCKTEMPLATE(tmpl_req, tmpl_rsp);
|
||||
CHECK_AND_ASSERT_MES(tmpl_rsp.status == CORE_RPC_STATUS_OK, false, "Failed to create block template after kernel hash found!");
|
||||
WLT_CHECK_AND_ASSERT_MES(tmpl_rsp.status == CORE_RPC_STATUS_OK, false, "Failed to create block template after kernel hash found!");
|
||||
|
||||
currency::block b = AUTO_VAL_INIT(b);
|
||||
currency::blobdata block_blob;
|
||||
bool res = epee::string_tools::parse_hexstr_to_binbuff(tmpl_rsp.blocktemplate_blob, block_blob);
|
||||
CHECK_AND_ASSERT_MES(res, false, "Failed to create block template after kernel hash found!");
|
||||
WLT_CHECK_AND_ASSERT_MES(res, false, "Failed to create block template after kernel hash found!");
|
||||
res = parse_and_validate_block_from_blob(block_blob, b);
|
||||
CHECK_AND_ASSERT_MES(res, false, "Failed to create block template after kernel hash found!");
|
||||
WLT_CHECK_AND_ASSERT_MES(res, false, "Failed to create block template after kernel hash found!");
|
||||
|
||||
if (rsp.last_block_hash != b.prev_id)
|
||||
{
|
||||
LOG_PRINT_YELLOW("Kernel was found but block is behindhand, b.prev_id=" << b.prev_id << ", last_block_hash=" << rsp.last_block_hash, LOG_LEVEL_0);
|
||||
WLT_LOG_YELLOW("Kernel was found but block is behindhand, b.prev_id=" << b.prev_id << ", last_block_hash=" << rsp.last_block_hash, LOG_LEVEL_0);
|
||||
return false;
|
||||
}
|
||||
|
||||
std::vector<const crypto::public_key*> keys_ptrs;
|
||||
CHECK_AND_ASSERT_MES(req.pos_entries[rsp.index].wallet_index < m_transfers.size(),
|
||||
WLT_CHECK_AND_ASSERT_MES(req.pos_entries[rsp.index].wallet_index < m_transfers.size(),
|
||||
false, "Wrong wallet_index at generating coinbase transacton");
|
||||
|
||||
const auto& target = m_transfers[req.pos_entries[rsp.index].wallet_index].m_ptx_wallet_info->m_tx.vout[m_transfers[req.pos_entries[rsp.index].wallet_index].m_internal_output_index].target;
|
||||
CHECK_AND_ASSERT_MES(target.type() == typeid(currency::txout_to_key), false, "wrong type_id in source transaction in coinbase tx");
|
||||
WLT_CHECK_AND_ASSERT_MES(target.type() == typeid(currency::txout_to_key), false, "wrong type_id in source transaction in coinbase tx");
|
||||
|
||||
const currency::txout_to_key& txtokey = boost::get<currency::txout_to_key>(target);
|
||||
keys_ptrs.push_back(&txtokey.key);
|
||||
|
|
@ -2286,7 +2288,7 @@ bool wallet2::build_minted_block(const currency::COMMAND_RPC_SCAN_POS::request&
|
|||
currency::etc_tx_time tt = AUTO_VAL_INIT(tt);
|
||||
tt.v = m_core_runtime_config.get_core_time();
|
||||
b.miner_tx.extra.push_back(tt);
|
||||
LOG_PRINT_MAGENTA("Applying actual timestamp: " << epee::misc_utils::get_time_str(tt.v), LOG_LEVEL_0);
|
||||
WLT_LOG_MAGENTA("Applying actual timestamp: " << epee::misc_utils::get_time_str(tt.v), LOG_LEVEL_0);
|
||||
|
||||
//sign block
|
||||
res = prepare_and_sign_pos_block(b,
|
||||
|
|
@ -2294,9 +2296,9 @@ bool wallet2::build_minted_block(const currency::COMMAND_RPC_SCAN_POS::request&
|
|||
get_tx_pub_key_from_extra(m_transfers[req.pos_entries[rsp.index].wallet_index].m_ptx_wallet_info->m_tx),
|
||||
m_transfers[req.pos_entries[rsp.index].wallet_index].m_internal_output_index,
|
||||
keys_ptrs);
|
||||
CHECK_AND_ASSERT_MES(res, false, "Failed to prepare_and_sign_pos_block");
|
||||
WLT_CHECK_AND_ASSERT_MES(res, false, "Failed to prepare_and_sign_pos_block");
|
||||
|
||||
LOG_PRINT_GREEN("Block constructed <" << get_block_hash(b) << ">, sending to core...", LOG_LEVEL_0);
|
||||
WLT_LOG_GREEN("Block constructed <" << get_block_hash(b) << ">, sending to core...", LOG_LEVEL_0);
|
||||
|
||||
currency::COMMAND_RPC_SUBMITBLOCK::request subm_req = AUTO_VAL_INIT(subm_req);
|
||||
currency::COMMAND_RPC_SUBMITBLOCK::response subm_rsp = AUTO_VAL_INIT(subm_rsp);
|
||||
|
|
@ -2304,17 +2306,17 @@ bool wallet2::build_minted_block(const currency::COMMAND_RPC_SCAN_POS::request&
|
|||
m_core_proxy->call_COMMAND_RPC_SUBMITBLOCK(subm_req, subm_rsp);
|
||||
if (subm_rsp.status != CORE_RPC_STATUS_OK)
|
||||
{
|
||||
LOG_ERROR("Constructed block is not accepted by core, status: " << subm_rsp.status);
|
||||
WLT_LOG_ERROR("Constructed block is not accepted by core, status: " << subm_rsp.status);
|
||||
return false;
|
||||
}
|
||||
LOG_PRINT_GREEN("POS block generated and accepted, congrats!", LOG_LEVEL_0);
|
||||
WLT_LOG_GREEN("POS block generated and accepted, congrats!", LOG_LEVEL_0);
|
||||
m_wcallback->on_pos_block_found(b);
|
||||
//@#@
|
||||
//double check timestamp
|
||||
if (time(NULL) - get_actual_timestamp(b) > 5)
|
||||
{
|
||||
LOG_PRINT_RED_L0("Found block (" << get_block_hash(b) << ") timestamp (" << get_actual_timestamp(b)
|
||||
<< ") is suspiciously less (" << time(NULL) - get_actual_timestamp(b) << ") then curren time( " << time(NULL) << ")");
|
||||
WLT_LOG_RED("Found block (" << get_block_hash(b) << ") timestamp (" << get_actual_timestamp(b)
|
||||
<< ") is suspiciously less (" << time(NULL) - get_actual_timestamp(b) << ") then curren time( " << time(NULL) << ")", LOG_LEVEL_0);
|
||||
}
|
||||
//
|
||||
return true;
|
||||
|
|
@ -2350,25 +2352,6 @@ bool wallet2::is_transfer_unlocked(const transfer_details& td) const
|
|||
return true;
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
namespace
|
||||
{
|
||||
template<typename T>
|
||||
T pop_random_value(std::vector<T>& vec)
|
||||
{
|
||||
CHECK_AND_ASSERT_MES(!vec.empty(), T(), "Vector must be non-empty");
|
||||
|
||||
size_t idx = crypto::rand<size_t>() % vec.size();
|
||||
T res = vec[idx];
|
||||
if (idx + 1 != vec.size())
|
||||
{
|
||||
vec[idx] = vec.back();
|
||||
}
|
||||
vec.resize(vec.size() - 1);
|
||||
|
||||
return res;
|
||||
}
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
void wallet2::push_offer(const bc_services::offer_details_ex& od, currency::transaction& res_tx)
|
||||
{
|
||||
currency::tx_destination_entry tx_dest;
|
||||
|
|
@ -2476,7 +2459,7 @@ void wallet2::request_alias_update(currency::extra_alias_entry& ai, currency::tr
|
|||
}
|
||||
bool r = currency::sign_extra_alias_entry(ai, m_account.get_keys().m_account_address.m_spend_public_key, m_account.get_keys().m_spend_secret_key);
|
||||
CHECK_AND_ASSERT_THROW_MES(r, "Failed to sign alias update");
|
||||
LOG_PRINT_L2("Generated upodate alias info: " << ENDL
|
||||
WLT_LOG_L2("Generated upodate alias info: " << ENDL
|
||||
<< "alias: " << ai.m_alias << ENDL
|
||||
<< "signature: " << currency::print_t_array(ai.m_sign) << ENDL
|
||||
<< "signed(owner) pub key: " << m_account.get_keys().m_account_address.m_spend_public_key << ENDL
|
||||
|
|
@ -2516,7 +2499,7 @@ bool wallet2::check_available_sources(std::list<uint64_t>& amounts)
|
|||
}
|
||||
|
||||
|
||||
LOG_PRINT_MAGENTA("[CHECK_AVAILABLE_SOURCES]: " << amounts << " res: " << res << ENDL <<" holds: " << holds, LOG_LEVEL_0);
|
||||
WLT_LOG_MAGENTA("[CHECK_AVAILABLE_SOURCES]: " << amounts << " res: " << res << ENDL <<" holds: " << holds, LOG_LEVEL_0);
|
||||
return res;
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
|
|
@ -2809,7 +2792,7 @@ void wallet2::add_transfers_to_expiration_list(const std::vector<uint64_t>& sele
|
|||
<< std::setw(2) << std::left << flags_before << " -> " << std::setw(2) << std::left << m_transfers[tr_ind].m_flags << " "
|
||||
<< get_transaction_hash(m_transfers[tr_ind].m_ptx_wallet_info->m_tx) << std::endl;
|
||||
}
|
||||
LOG_PRINT_GREEN(m_money_expirations.back().selected_transfers.size() << " transfer(s) added to expiration list:" << ENDL <<
|
||||
WLT_LOG_GREEN(m_money_expirations.back().selected_transfers.size() << " transfer(s) added to expiration list:" << ENDL <<
|
||||
"index amount flags tx hash" << ENDL <<
|
||||
ss.str() <<
|
||||
"change_amount: " << print_money_brief(change_amount) << ", expire(s) at: " << expiration, LOG_LEVEL_0);
|
||||
|
|
@ -2824,7 +2807,7 @@ void wallet2::remove_transfer_from_expiration_list(uint64_t transfer_index)
|
|||
auto jt = std::find(st.begin(), st.end(), transfer_index);
|
||||
if (jt != st.end())
|
||||
{
|
||||
LOG_PRINT_GREEN("Transfer [" << transfer_index << "], amount: " << print_money(m_transfers[transfer_index].amount()) << ", tx: " << get_transaction_hash(m_transfers[transfer_index].m_ptx_wallet_info->m_tx) <<
|
||||
WLT_LOG_GREEN("Transfer [" << transfer_index << "], amount: " << print_money(m_transfers[transfer_index].amount()) << ", tx: " << get_transaction_hash(m_transfers[transfer_index].m_ptx_wallet_info->m_tx) <<
|
||||
" was removed from the expiration list", LOG_LEVEL_0);
|
||||
st.erase(jt);
|
||||
if (st.empty())
|
||||
|
|
@ -2839,7 +2822,7 @@ void wallet2::remove_transfer_from_expiration_list(uint64_t transfer_index)
|
|||
uint32_t flags_before = m_transfers[transfer_index].m_flags;
|
||||
m_transfers[transfer_index].m_flags &= ~WALLET_TRANSFER_DETAIL_FLAG_BLOCKED;
|
||||
m_transfers[transfer_index].m_flags &= ~WALLET_TRANSFER_DETAIL_FLAG_ESCROW_PROPOSAL_RESERVATION;
|
||||
LOG_PRINT_BLUE("Transfer [" << transfer_index << "] was cleared from escrow proposal reservation, flags: " << flags_before << " -> " << m_transfers[transfer_index].m_flags << ", reason: intentional removing from expiration list", LOG_LEVEL_0);
|
||||
WLT_LOG_BLUE("Transfer [" << transfer_index << "] was cleared from escrow proposal reservation, flags: " << flags_before << " -> " << m_transfers[transfer_index].m_flags << ", reason: intentional removing from expiration list", LOG_LEVEL_0);
|
||||
|
||||
// (don't change m_spent flag, because transfer status is unclear - the caller should take care of it)
|
||||
}
|
||||
|
|
@ -3010,7 +2993,7 @@ bool wallet2::prepare_tx_sources(uint64_t needed_money, size_t fake_outputs_coun
|
|||
src.real_out_tx_key = get_tx_pub_key_from_extra(td.m_ptx_wallet_info->m_tx);
|
||||
src.real_output = interted_it - src.outputs.begin();
|
||||
src.real_output_in_tx_index = td.m_internal_output_index;
|
||||
detail::print_source_entry(src);
|
||||
print_source_entry(src);
|
||||
++i;
|
||||
}
|
||||
return true;
|
||||
|
|
@ -3066,7 +3049,7 @@ void wallet2::send_transaction_to_network(const transaction& tx)
|
|||
THROW_IF_TRUE_WALLET_EX(daemon_send_resp.status == CORE_RPC_STATUS_DISCONNECTED, error::wallet_internal_error, "Transfer attempt while daemon offline");
|
||||
THROW_IF_TRUE_WALLET_EX(daemon_send_resp.status != CORE_RPC_STATUS_OK, error::tx_rejected, tx, daemon_send_resp.status);
|
||||
|
||||
LOG_PRINT_L2("transaction " << get_transaction_hash(tx) << " generated ok and sent to daemon:" << ENDL << currency::obj_to_json_str(tx));
|
||||
WLT_LOG_L2("transaction " << get_transaction_hash(tx) << " generated ok and sent to daemon:" << ENDL << currency::obj_to_json_str(tx));
|
||||
}
|
||||
|
||||
void wallet2::add_sent_tx_detailed_info(const transaction& tx,
|
||||
|
|
@ -3099,7 +3082,7 @@ void wallet2::mark_transfers_with_flag(const std::vector<uint64_t>& selected_tra
|
|||
THROW_IF_TRUE_WALLET_EX(i >= m_transfers.size(), error::wallet_internal_error, "i >= m_transfers.size()");
|
||||
uint32_t flags_before = m_transfers[i].m_flags;
|
||||
m_transfers[i].m_flags |= flag;
|
||||
LOG_PRINT_L1("marking transfer #" << std::setfill('0') << std::right << std::setw(3) << i << " with flag " << flag << " : " << flags_before << " -> " << m_transfers[i].m_flags <<
|
||||
WLT_LOG_L1("marking transfer #" << std::setfill('0') << std::right << std::setw(3) << i << " with flag " << flag << " : " << flags_before << " -> " << m_transfers[i].m_flags <<
|
||||
(reason.empty() ? "" : ", reason: ") << reason);
|
||||
}
|
||||
}
|
||||
|
|
@ -3111,7 +3094,7 @@ void wallet2::clear_transfers_from_flag(const std::vector<uint64_t>& selected_tr
|
|||
THROW_IF_TRUE_WALLET_EX(i >= m_transfers.size(), error::wallet_internal_error, "i >= m_transfers.size()");
|
||||
uint32_t flags_before = m_transfers[i].m_flags;
|
||||
m_transfers[i].m_flags &= ~flag;
|
||||
LOG_PRINT_L1("clearing transfer #" << std::setfill('0') << std::right << std::setw(3) << i << " from flag " << flag << " : " << flags_before << " -> " << m_transfers[i].m_flags <<
|
||||
WLT_LOG_L1("clearing transfer #" << std::setfill('0') << std::right << std::setw(3) << i << " from flag " << flag << " : " << flags_before << " -> " << m_transfers[i].m_flags <<
|
||||
(reason.empty() ? "" : ", reason: ") << reason);
|
||||
}
|
||||
}
|
||||
|
|
@ -3136,7 +3119,7 @@ bool wallet2::extract_offers_from_transfer_entry(size_t i, std::unordered_map<cr
|
|||
bc_services::offer_details od;
|
||||
if (!get_type_in_variant_container(m_transfer_history[i].srv_attachments, od))
|
||||
{
|
||||
LOG_ERROR("Transaction history entry " << i << " market as type " << m_transfer_history[i].tx_type << " but get_type_in_variant_container returned false for bc_services::offer_details");
|
||||
WLT_LOG_ERROR("Transaction history entry " << i << " market as type " << m_transfer_history[i].tx_type << " but get_type_in_variant_container returned false for bc_services::offer_details");
|
||||
break;
|
||||
}
|
||||
crypto::hash h = null_hash;
|
||||
|
|
@ -3157,7 +3140,7 @@ bool wallet2::extract_offers_from_transfer_entry(size_t i, std::unordered_map<cr
|
|||
bc_services::update_offer uo;
|
||||
if (!get_type_in_variant_container(m_transfer_history[i].srv_attachments, uo))
|
||||
{
|
||||
LOG_ERROR("Transaction history entry " << i << " market as type " << m_transfer_history[i].tx_type << " but get_type_in_variant_container returned false for update_offer");
|
||||
WLT_LOG_ERROR("Transaction history entry " << i << " market as type " << m_transfer_history[i].tx_type << " but get_type_in_variant_container returned false for update_offer");
|
||||
break;
|
||||
}
|
||||
crypto::hash h = null_hash;
|
||||
|
|
@ -3176,7 +3159,7 @@ bool wallet2::extract_offers_from_transfer_entry(size_t i, std::unordered_map<cr
|
|||
auto it = offers_local.find(h_old);
|
||||
if (it == offers_local.end())
|
||||
{
|
||||
LOG_PRINT_L3("Unable to find original tx record " << h_old << " in update offer " << h);
|
||||
WLT_LOG_L3("Unable to find original tx record " << h_old << " in update offer " << h);
|
||||
break;
|
||||
}
|
||||
//keep original timestamp
|
||||
|
|
@ -3189,14 +3172,14 @@ bool wallet2::extract_offers_from_transfer_entry(size_t i, std::unordered_map<cr
|
|||
bc_services::cancel_offer co;
|
||||
if (!get_type_in_variant_container(m_transfer_history[i].srv_attachments, co))
|
||||
{
|
||||
LOG_ERROR("Transaction history entry " << i << " market as type " << m_transfer_history[i].tx_type << " but get_type_in_variant_container returned false for cancel_offer");
|
||||
WLT_LOG_ERROR("Transaction history entry " << i << " market as type " << m_transfer_history[i].tx_type << " but get_type_in_variant_container returned false for cancel_offer");
|
||||
break;
|
||||
}
|
||||
crypto::hash h = co.tx_id;
|
||||
auto it = offers_local.find(h);
|
||||
if (it == offers_local.end())
|
||||
{
|
||||
LOG_PRINT_L3("Unable to find original tx record " << h << " in cancel offer " << h);
|
||||
WLT_LOG_L3("Unable to find original tx record " << h << " in cancel offer " << h);
|
||||
break;
|
||||
}
|
||||
offers_local.erase(it);
|
||||
|
|
@ -3251,7 +3234,7 @@ bool wallet2::get_actual_offers(std::list<bc_services::offer_details_ex>& offers
|
|||
//----------------------------------------------------------------------------------------------------
|
||||
uint64_t wallet2::select_indices_for_transfer(std::vector<uint64_t>& selected_indexes, free_amounts_cache_type& found_free_amounts, uint64_t needed_money, uint64_t fake_outputs_count)
|
||||
{
|
||||
LOG_PRINT_GREEN("Selecting indices for transfer found_free_amounts.size()=" << found_free_amounts.size() << "...", LOG_LEVEL_0);
|
||||
WLT_LOG_GREEN("Selecting indices for transfer found_free_amounts.size()=" << found_free_amounts.size() << "...", LOG_LEVEL_0);
|
||||
uint64_t found_money = 0;
|
||||
while(found_money < needed_money && found_free_amounts.size())
|
||||
{
|
||||
|
|
@ -3259,20 +3242,20 @@ uint64_t wallet2::select_indices_for_transfer(std::vector<uint64_t>& selected_in
|
|||
if (!(it != found_free_amounts.end() && it->second.size()))
|
||||
{
|
||||
it = --found_free_amounts.end();
|
||||
CHECK_AND_ASSERT_MES(it->second.size(), 0, "internal error: empty found_free_amounts map");
|
||||
WLT_CHECK_AND_ASSERT_MES(it->second.size(), 0, "internal error: empty found_free_amounts map");
|
||||
}
|
||||
if (is_transfer_ready_to_go(m_transfers[*it->second.begin()], fake_outputs_count))
|
||||
{
|
||||
found_money += it->first;
|
||||
selected_indexes.push_back(*it->second.begin());
|
||||
LOG_PRINT_L2("Selected index: " << *it->second.begin() << ", transfer_details: " << ENDL << epee::serialization::store_t_to_json(m_transfers[*it->second.begin()]));
|
||||
WLT_LOG_L2("Selected index: " << *it->second.begin() << ", transfer_details: " << ENDL << epee::serialization::store_t_to_json(m_transfers[*it->second.begin()]));
|
||||
}
|
||||
it->second.erase(it->second.begin());
|
||||
if (!it->second.size())
|
||||
found_free_amounts.erase(it);
|
||||
|
||||
}
|
||||
LOG_PRINT_GREEN("Selected " << print_money(found_money) << " coins, found_free_amounts.size()=" << found_free_amounts.size(), LOG_LEVEL_0);
|
||||
WLT_LOG_GREEN("Selected " << print_money(found_money) << " coins, found_free_amounts.size()=" << found_free_amounts.size(), LOG_LEVEL_0);
|
||||
return found_money;
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
|
|
@ -3297,7 +3280,7 @@ bool wallet2::is_transfer_able_to_go(const transfer_details& td, uint64_t fake_o
|
|||
//----------------------------------------------------------------------------------------------------
|
||||
bool wallet2::prepare_free_transfers_cache(uint64_t fake_outputs_count)
|
||||
{
|
||||
LOG_PRINT_L2("Preparing transfers_cache...");
|
||||
WLT_LOG_L2("Preparing transfers_cache...");
|
||||
uint64_t count = 0;
|
||||
if (!m_found_free_amounts.size() || fake_outputs_count != m_fake_outputs_count)
|
||||
{
|
||||
|
|
@ -3314,7 +3297,7 @@ bool wallet2::prepare_free_transfers_cache(uint64_t fake_outputs_count)
|
|||
m_fake_outputs_count = fake_outputs_count;
|
||||
}
|
||||
|
||||
LOG_PRINT_L2("Transfers_cache prepared. " << count << " items cached for " << m_found_free_amounts.size() << " amounts");
|
||||
WLT_LOG_L2("Transfers_cache prepared. " << count << " items cached for " << m_found_free_amounts.size() << " amounts");
|
||||
return true;
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
|
|
@ -3396,7 +3379,7 @@ std::string wallet2::get_alias_for_address(const std::string& addr)
|
|||
currency::COMMAND_RPC_GET_ALIASES_BY_ADDRESS::response res = AUTO_VAL_INIT(res);
|
||||
if (!m_core_proxy->call_COMMAND_RPC_GET_ALIASES_BY_ADDRESS(req, res))
|
||||
{
|
||||
LOG_PRINT_L0("Failed to COMMAND_RPC_GET_ALIASES_BY_ADDRESS");
|
||||
WLT_LOG_L0("Failed to COMMAND_RPC_GET_ALIASES_BY_ADDRESS");
|
||||
return "";
|
||||
}
|
||||
return res.alias_info.alias;
|
||||
|
|
@ -3424,7 +3407,7 @@ bool wallet2::is_connected_to_net()
|
|||
currency::COMMAND_RPC_GET_INFO::response res = AUTO_VAL_INIT(res);
|
||||
if (!m_core_proxy->call_COMMAND_RPC_GET_INFO(req, res))
|
||||
{
|
||||
LOG_PRINT_L0("Failed to COMMAND_RPC_GET_INFO");
|
||||
WLT_LOG_L0("Failed to COMMAND_RPC_GET_INFO");
|
||||
return false;
|
||||
}
|
||||
return (res.synchronized_connections_count) ? true : false;
|
||||
|
|
@ -3439,7 +3422,7 @@ void wallet2::process_genesis_if_needed(const currency::block& genesis)
|
|||
|
||||
crypto::hash genesis_hash = get_block_hash(genesis);
|
||||
if (m_blockchain.size() == 1 && m_blockchain[0] != genesis_hash)
|
||||
LOG_PRINT("Changing genesis block for wallet " << m_account.get_public_address_str() << ":" << ENDL << " " << m_blockchain[0] << " -> " << genesis_hash, LOG_LEVEL_0);
|
||||
WLT_LOG_L0("Changing genesis block for wallet " << m_account.get_public_address_str() << ":" << ENDL << " " << m_blockchain[0] << " -> " << genesis_hash);
|
||||
|
||||
m_blockchain.clear();
|
||||
|
||||
|
|
@ -3447,14 +3430,14 @@ void wallet2::process_genesis_if_needed(const currency::block& genesis)
|
|||
m_local_bc_height = 1;
|
||||
m_last_bc_timestamp = genesis.timestamp;
|
||||
|
||||
LOG_PRINT_L2("Processing genesis block: " << genesis_hash);
|
||||
WLT_LOG_L2("Processing genesis block: " << genesis_hash);
|
||||
process_new_transaction(genesis.miner_tx, 0, genesis);
|
||||
}
|
||||
|
||||
void wallet2::set_genesis(const crypto::hash& genesis_hash)
|
||||
{
|
||||
THROW_IF_TRUE_WALLET_EX(m_blockchain.size() != 1, error::wallet_internal_error, "Can't change wallet genesis hash once the blockchain has been populated");
|
||||
LOG_PRINT("Changing genesis hash for wallet " << m_account.get_public_address_str() << ":" << ENDL << " " << m_blockchain[0] << " -> " << genesis_hash, LOG_LEVEL_0);
|
||||
WLT_LOG_L0("Changing genesis hash for wallet " << m_account.get_public_address_str() << ":" << ENDL << " " << m_blockchain[0] << " -> " << genesis_hash);
|
||||
m_blockchain[0] = genesis_hash;
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
|
|
@ -3463,7 +3446,7 @@ void wallet2::print_tx_sent_message(const currency::transaction& tx, const std::
|
|||
//uint64_t balance_unlocked = 0;
|
||||
//uint64_t balance_total = balance(balance_unlocked);
|
||||
|
||||
LOG_PRINT_CYAN("Transaction " << get_transaction_hash(tx) << " was successfully sent " << description << ENDL
|
||||
WLT_LOG_CYAN("Transaction " << get_transaction_hash(tx) << " was successfully sent " << description << ENDL
|
||||
<< "Commission: " << std::setw(21) << std::right << print_money(fee) << ENDL
|
||||
// << "Balance: " << std::setw(21) << print_money(balance_total) << ENDL
|
||||
// << "Unlocked: " << std::setw(21) << print_money(balance_unlocked) << ENDL
|
||||
|
|
@ -3479,12 +3462,19 @@ uint64_t wallet2::get_tx_expiration_median() const
|
|||
|
||||
if (res.status != CORE_RPC_STATUS_OK)
|
||||
{
|
||||
LOG_ERROR("COMMAND_RPC_GET_CURRENT_CORE_TX_EXPIRATION_MEDIAN failed, status: " << res.status);
|
||||
WLT_LOG_ERROR("COMMAND_RPC_GET_CURRENT_CORE_TX_EXPIRATION_MEDIAN failed, status: " << res.status);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return res.expiration_median;
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
void wallet2::print_source_entry(const currency::tx_source_entry& src) const
|
||||
{
|
||||
std::ostringstream indexes;
|
||||
std::for_each(src.outputs.begin(), src.outputs.end(), [&](const currency::tx_source_entry::output_entry& s_e) { indexes << s_e.first << " "; });
|
||||
WLT_LOG_L0("amount=" << currency::print_money(src.amount) << ", real_output=" << src.real_output << ", real_output_in_tx_index=" << src.real_output_in_tx_index << ", indexes: " << indexes.str());
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
|
||||
} // namespace tools
|
||||
|
|
|
|||
|
|
@ -46,6 +46,22 @@
|
|||
#define LOG_DEFAULT_CHANNEL "wallet"
|
||||
ENABLE_CHANNEL_BY_DEFAULT("wallet");
|
||||
|
||||
// wallet-specific logging functions
|
||||
#define WLT_LOG_L0(msg) LOG_PRINT_L0("[W:" << m_log_prefix << "]" << msg)
|
||||
#define WLT_LOG_L1(msg) LOG_PRINT_L1("[W:" << m_log_prefix << "]" << msg)
|
||||
#define WLT_LOG_L2(msg) LOG_PRINT_L2("[W:" << m_log_prefix << "]" << msg)
|
||||
#define WLT_LOG_L3(msg) LOG_PRINT_L3("[W:" << m_log_prefix << "]" << msg)
|
||||
#define WLT_LOG_L4(msg) LOG_PRINT_L4("[W:" << m_log_prefix << "]" << msg)
|
||||
#define WLT_LOG_ERROR(msg) LOG_ERROR("[W:" << m_log_prefix << "]" << msg)
|
||||
#define WLT_LOG_BLUE(msg, log_level) LOG_PRINT_BLUE("[W:" << m_log_prefix << "]" << msg, log_level)
|
||||
#define WLT_LOG_CYAN(msg, log_level) LOG_PRINT_CYAN("[W:" << m_log_prefix << "]" << msg, log_level)
|
||||
#define WLT_LOG_GREEN(msg, log_level) LOG_PRINT_GREEN("[W:" << m_log_prefix << "]" << msg, log_level)
|
||||
#define WLT_LOG_MAGENTA(msg, log_level) LOG_PRINT_MAGENTA("[W:" << m_log_prefix << "]" << msg, log_level)
|
||||
#define WLT_LOG_RED(msg, log_level) LOG_PRINT_RED("[W:" << m_log_prefix << "]" << msg, log_level)
|
||||
#define WLT_LOG_YELLOW(msg, log_level) LOG_PRINT_YELLOW("[W:" << m_log_prefix << "]" << msg, log_level)
|
||||
#define WLT_CHECK_AND_ASSERT_MES(expr, ret, msg) CHECK_AND_ASSERT_MES(expr, ret, "[W:" << m_log_prefix << "]" << msg)
|
||||
#define WLT_CHECK_AND_ASSERT_MES_NO_RET(expr, msg) CHECK_AND_ASSERT_MES_NO_RET(expr, "[W:" << m_log_prefix << "]" << msg)
|
||||
|
||||
namespace tools
|
||||
{
|
||||
#pragma pack(push, 1)
|
||||
|
|
@ -68,6 +84,8 @@ namespace tools
|
|||
class i_wallet2_callback
|
||||
{
|
||||
public:
|
||||
virtual ~i_wallet2_callback() = default;
|
||||
|
||||
virtual void on_new_block(uint64_t /*height*/, const currency::block& /*block*/) {}
|
||||
virtual void on_transfer2(const wallet_rpc::wallet_transfer_info& wti, uint64_t balance, uint64_t unlocked_balance, uint64_t total_mined) {}
|
||||
virtual void on_pos_block_found(const currency::block& /*block*/) {}
|
||||
|
|
@ -112,7 +130,8 @@ namespace tools
|
|||
m_height_of_start_sync(0),
|
||||
m_last_sync_percent(0),
|
||||
m_fake_outputs_count(0),
|
||||
m_do_rise_transfer(false)
|
||||
m_do_rise_transfer(false),
|
||||
m_log_prefix("???")
|
||||
{
|
||||
m_core_runtime_config = currency::get_default_core_runtime_config();
|
||||
};
|
||||
|
|
@ -236,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();
|
||||
|
|
@ -478,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);
|
||||
|
|
@ -548,6 +570,10 @@ private:
|
|||
bool handle_expiration_list(uint64_t tx_expiration_ts_median);
|
||||
void handle_contract_expirations(uint64_t tx_expiration_ts_median);
|
||||
|
||||
void change_contract_state(wallet_rpc::escrow_contract_details_basic& contract, uint32_t new_state, const crypto::hash& contract_id, const wallet_rpc::wallet_transfer_info& wti) const;
|
||||
void change_contract_state(wallet_rpc::escrow_contract_details_basic& contract, uint32_t new_state, const crypto::hash& contract_id, const std::string& reason = "internal intention") const;
|
||||
|
||||
|
||||
uint64_t get_tx_expiration_median() const;
|
||||
|
||||
void print_tx_sent_message(const currency::transaction& tx, const std::string& description, uint64_t fee);
|
||||
|
|
@ -556,13 +582,23 @@ private:
|
|||
bool validate_escrow_proposal(const wallet_rpc::wallet_transfer_info& wti, const bc_services::proposal_body& prop,
|
||||
std::vector<currency::payload_items_v>& decrypted_items, crypto::hash& ms_id, bc_services::contract_private_details& cpd);
|
||||
|
||||
bool validate_escrow_release(const currency::transaction& tx, bool release_type_normal, const bc_services::contract_private_details& cpd,
|
||||
const currency::txout_multisig& source_ms_out, const crypto::hash& ms_id, size_t source_ms_out_index, const currency::transaction& source_tx, const currency::account_keys& a_keys) const;
|
||||
|
||||
bool validate_escrow_contract(const wallet_rpc::wallet_transfer_info& wti, const bc_services::contract_private_details& cpd, bool is_a,
|
||||
const std::vector<currency::payload_items_v>& decrypted_items, crypto::hash& ms_id, bc_services::escrow_relese_templates_body& rtb);
|
||||
|
||||
bool validate_escrow_cancel_release(const currency::transaction& tx, const wallet_rpc::wallet_transfer_info& wti, const bc_services::escrow_cancel_templates_body& ectb,
|
||||
const std::vector<currency::payload_items_v>& decrypted_items, crypto::hash& ms_id, bc_services::contract_private_details& cpd, const currency::transaction& source_tx,
|
||||
size_t source_ms_out_index, const currency::account_keys& b_keys, uint64_t minimum_release_fee) const;
|
||||
|
||||
bool validate_escrow_cancel_proposal(const wallet_rpc::wallet_transfer_info& wti, const bc_services::escrow_cancel_templates_body& ectb,
|
||||
const std::vector<currency::payload_items_v>& decrypted_items, crypto::hash& ms_id, bc_services::contract_private_details& cpd,
|
||||
const currency::transaction& proposal_template_tx);
|
||||
|
||||
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;
|
||||
|
||||
struct construct_tx_param
|
||||
{
|
||||
std::vector<currency::tx_destination_entry> dsts;
|
||||
|
|
@ -608,6 +644,7 @@ private:
|
|||
|
||||
|
||||
currency::account_base m_account;
|
||||
std::string m_log_prefix; // part of pub address, prefix for logging functions
|
||||
std::wstring m_wallet_file;
|
||||
std::string m_password;
|
||||
std::vector<crypto::hash> m_blockchain;
|
||||
|
|
@ -862,13 +899,6 @@ namespace tools
|
|||
splitted_dsts.push_back(change_dst);
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
inline void print_source_entry(const currency::tx_source_entry& src)
|
||||
{
|
||||
std::ostringstream indexes;
|
||||
std::for_each(src.outputs.begin(), src.outputs.end(), [&](const currency::tx_source_entry::output_entry& s_e) { indexes << s_e.first << " "; });
|
||||
LOG_PRINT_L0("amount=" << currency::print_money(src.amount) << ", real_output=" <<src.real_output << ", real_output_in_tx_index=" << src.real_output_in_tx_index << ", indexes: " << indexes.str());
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
template<typename T>
|
||||
|
|
@ -905,7 +935,7 @@ namespace tools
|
|||
#ifdef _DEBUG
|
||||
if (final_detinations.size() > 10)
|
||||
{
|
||||
LOG_PRINT_L0("final_detinations.size()=" << final_detinations.size());
|
||||
WLT_LOG_L0("final_detinations.size()=" << final_detinations.size());
|
||||
}
|
||||
#endif
|
||||
//@#@
|
||||
|
|
@ -998,7 +1028,7 @@ namespace tools
|
|||
TIME_MEASURE_FINISH_MS(sign_ms_input_time);
|
||||
|
||||
THROW_IF_TRUE_WALLET_EX(CURRENCY_MAX_TRANSACTION_BLOB_SIZE <= get_object_blobsize(tx), error::tx_too_big, tx, m_upper_transaction_size_limit);
|
||||
LOG_PRINT_GREEN("[prepare_transaction]: get_needed_money_time: " << get_needed_money_time << " ms"
|
||||
WLT_LOG_GREEN("[prepare_transaction]: get_needed_money_time: " << get_needed_money_time << " ms"
|
||||
<< ", prepare_tx_sources_time: " << prepare_tx_sources_time << " ms"
|
||||
<< ", prepare_tx_destinations_time: " << prepare_tx_destinations_time << " ms"
|
||||
<< ", construct_tx_time: " << construct_tx_time << " ms"
|
||||
|
|
@ -1088,7 +1118,7 @@ namespace tools
|
|||
add_sent_tx_detailed_info(tx, prepared_destinations, selected_transfers);
|
||||
TIME_MEASURE_FINISH(add_sent_tx_detailed_info_time);
|
||||
|
||||
LOG_PRINT_GREEN("[wallet::transfer] prepare_transaction_time: " << print_fixed_decimal_point(prepare_transaction_time, 3)
|
||||
WLT_LOG_GREEN("[wallet::transfer] prepare_transaction_time: " << print_fixed_decimal_point(prepare_transaction_time, 3)
|
||||
<< ", precalculation_time: " << print_fixed_decimal_point(precalculation_time, 3)
|
||||
<< ", send_transaction_to_network_time: " << print_fixed_decimal_point(send_transaction_to_network_time, 3)
|
||||
<< ", mark_transfers_as_spent_time: " << print_fixed_decimal_point(mark_transfers_as_spent_time, 3)
|
||||
|
|
@ -1202,6 +1232,24 @@ namespace tools
|
|||
|
||||
}
|
||||
|
||||
#if !defined(KEEP_WALLET_LOG_MACROS)
|
||||
#undef WLT_LOG_L0
|
||||
#undef WLT_LOG_L1
|
||||
#undef WLT_LOG_L2
|
||||
#undef WLT_LOG_L3
|
||||
#undef WLT_LOG_L4
|
||||
#undef WLT_LOG_ERROR
|
||||
#undef WLT_LOG_BLUE
|
||||
#undef WLT_LOG_CYAN
|
||||
#undef WLT_LOG_GREEN
|
||||
#undef WLT_LOG_MAGENTA
|
||||
#undef WLT_LOG_RED
|
||||
#undef WLT_LOG_YELLOW
|
||||
#undef WLT_CHECK_AND_ASSERT_MES
|
||||
#undef WLT_CHECK_AND_ASSERT_MES_NO_RET
|
||||
#endif
|
||||
|
||||
|
||||
#undef LOG_DEFAULT_CHANNEL
|
||||
#define LOG_DEFAULT_CHANNEL "wallet"
|
||||
ENABLE_CHANNEL_BY_DEFAULT("wallet");
|
||||
ENABLE_CHANNEL_BY_DEFAULT("wallet");
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
// Distributed under the MIT/X11 software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#define KEEP_WALLET_LOG_MACROS
|
||||
#include "wallet2.h"
|
||||
#include "currency_core/currency_format_utils.h"
|
||||
|
||||
|
|
@ -21,7 +22,7 @@ bool wallet2::validate_escrow_proposal(const wallet_rpc::wallet_transfer_info& w
|
|||
bc_services::contract_private_details& cpd /* OUT */
|
||||
)
|
||||
{
|
||||
#define LOC_CHK(cond, mes) CHECK_AND_ASSERT_MES(cond, false, "Invalid escrow proposal: " << mes << ". tx: " << get_transaction_hash(wti.tx));
|
||||
#define LOC_CHK(cond, mes) WLT_CHECK_AND_ASSERT_MES(cond, false, "Invalid escrow proposal: " << mes << ". tx: " << get_transaction_hash(wti.tx));
|
||||
|
||||
// I. validate escrow proposal tx
|
||||
const transaction& escrow_proposal_tx = wti.tx;
|
||||
|
|
@ -123,10 +124,10 @@ bool wallet2::validate_escrow_proposal(const wallet_rpc::wallet_transfer_info& w
|
|||
// bool wallet2::handle_proposal(const currency::transaction& escrow_proposal_tx, wallet_rpc::wallet_transfer_info& wti, const bc_services::proposal_body& prop)
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
|
||||
bool validate_escrow_release(const transaction& tx, bool release_type_normal, const bc_services::contract_private_details& cpd,
|
||||
const txout_multisig& source_ms_out, const crypto::hash& ms_id, size_t source_ms_out_index, const transaction& source_tx, const currency::account_keys& a_keys)
|
||||
bool wallet2::validate_escrow_release(const transaction& tx, bool release_type_normal, const bc_services::contract_private_details& cpd,
|
||||
const txout_multisig& source_ms_out, const crypto::hash& ms_id, size_t source_ms_out_index, const transaction& source_tx, const currency::account_keys& a_keys) const
|
||||
{
|
||||
#define LOC_CHK(cond, mes) CHECK_AND_ASSERT_MES(cond, false, "Invalid escrow " << (release_type_normal ? "normal" : "burn") << " release template: " << mes);
|
||||
#define LOC_CHK(cond, mes) WLT_CHECK_AND_ASSERT_MES(cond, false, "Invalid escrow " << (release_type_normal ? "normal" : "burn") << " release template: " << mes);
|
||||
|
||||
// (1/5) inputs
|
||||
LOC_CHK(tx.vin.size() == 1, "vin size expected to be 1, actual is " << tx.vin.size());
|
||||
|
|
@ -246,7 +247,7 @@ bool wallet2::validate_escrow_contract(const wallet_rpc::wallet_transfer_info& w
|
|||
crypto::hash& ms_id, /* OUT */
|
||||
bc_services::escrow_relese_templates_body& rtb /* OUT */)
|
||||
{
|
||||
#define LOC_CHK(cond, mes) CHECK_AND_ASSERT_MES(cond, false, "Invalid escrow contract: " << mes << ". Escrow party: " << (is_a ? "A" : "B") << ". tx: " << get_transaction_hash(wti.tx));
|
||||
#define LOC_CHK(cond, mes) WLT_CHECK_AND_ASSERT_MES(cond, false, "Invalid escrow contract: " << mes << ". Escrow party: " << (is_a ? "A" : "B") << ". tx: " << get_transaction_hash(wti.tx));
|
||||
bool r = false;
|
||||
|
||||
// TODO: validate A-part of transaction?
|
||||
|
|
@ -294,7 +295,7 @@ uint64_t wallet2::get_minimum_allowed_fee_for_contract(const crypto::hash& ms_id
|
|||
auto it = m_multisig_transfers.find(ms_id);
|
||||
if (it == m_multisig_transfers.end())
|
||||
{
|
||||
LOG_ERROR("get_minimum_allowed_fee_for_contract called with unknown id: " << ms_id << ", assuming TX_MINIMUM_FEE=" << TX_MINIMUM_FEE);
|
||||
WLT_LOG_ERROR("get_minimum_allowed_fee_for_contract called with unknown id: " << ms_id << ", assuming TX_MINIMUM_FEE=" << TX_MINIMUM_FEE);
|
||||
return TX_MINIMUM_FEE;
|
||||
}
|
||||
uint64_t tx_fee = get_tx_fee(it->second.m_ptx_wallet_info->m_tx);
|
||||
|
|
@ -304,11 +305,11 @@ uint64_t wallet2::get_minimum_allowed_fee_for_contract(const crypto::hash& ms_id
|
|||
// TODO move here:
|
||||
// bool wallet2::handle_contract()
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
bool validate_escrow_cancel_release(const currency::transaction& tx, const wallet_rpc::wallet_transfer_info& wti, const bc_services::escrow_cancel_templates_body& ectb,
|
||||
bool wallet2::validate_escrow_cancel_release(const currency::transaction& tx, const wallet_rpc::wallet_transfer_info& wti, const bc_services::escrow_cancel_templates_body& ectb,
|
||||
const std::vector<currency::payload_items_v>& decrypted_items, crypto::hash& ms_id, bc_services::contract_private_details& cpd, const currency::transaction& source_tx,
|
||||
size_t source_ms_out_index, const currency::account_keys& b_keys, uint64_t minimum_release_fee)
|
||||
size_t source_ms_out_index, const currency::account_keys& b_keys, uint64_t minimum_release_fee) const
|
||||
{
|
||||
#define LOC_CHK(cond, mes) CHECK_AND_ASSERT_MES(cond, false, "Invalid escrow cancel release template: " << mes);
|
||||
#define LOC_CHK(cond, mes) WLT_CHECK_AND_ASSERT_MES(cond, false, "Invalid escrow cancel release template: " << mes);
|
||||
|
||||
// (1/5) inputs
|
||||
LOC_CHK(tx.vin.size() == 1, "vin size expected to be 1, actual is " << tx.vin.size());
|
||||
|
|
@ -402,7 +403,7 @@ bool validate_escrow_cancel_release(const currency::transaction& tx, const walle
|
|||
bool wallet2::validate_escrow_cancel_proposal(const wallet_rpc::wallet_transfer_info& wti, const bc_services::escrow_cancel_templates_body& ectb,
|
||||
const std::vector<currency::payload_items_v>& decrypted_items, crypto::hash& ms_id, bc_services::contract_private_details& cpd, const currency::transaction& proposal_template_tx)
|
||||
{
|
||||
#define LOC_CHK(cond, mes) CHECK_AND_ASSERT_MES(cond, false, "Invalid escrow cancellation request: " << mes << ". ms id: " << ms_id << ", tx: " << get_transaction_hash(wti.tx));
|
||||
#define LOC_CHK(cond, mes) WLT_CHECK_AND_ASSERT_MES(cond, false, "Invalid escrow cancellation request: " << mes << ". ms id: " << ms_id << ", tx: " << get_transaction_hash(wti.tx));
|
||||
|
||||
const transaction& cancellation_request_tx = wti.tx;
|
||||
|
||||
|
|
|
|||
|
|
@ -313,11 +313,8 @@ bool bad_chain_switching_with_rollback::c1(currency::core& c, size_t ev_index, c
|
|||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------------------------
|
||||
|
||||
struct tx_in_pool_info
|
||||
{
|
||||
tx_in_pool_info() {}
|
||||
tx_in_pool_info(crypto::hash hash, size_t blobsize) : hash(hash), blobsize(blobsize) {}
|
||||
crypto::hash hash;
|
||||
size_t blobsize;
|
||||
};
|
||||
|
|
@ -325,8 +322,13 @@ struct tx_in_pool_info
|
|||
struct params_tx_pool
|
||||
{
|
||||
params_tx_pool() {}
|
||||
params_tx_pool(crypto::hash hash, size_t blobsize) : txs({ tx_in_pool_info(hash, blobsize) }) {}
|
||||
params_tx_pool(crypto::hash hash1, size_t blobsize1, crypto::hash hash2, size_t blobsize2) : txs({ tx_in_pool_info(hash1, blobsize1), tx_in_pool_info(hash2, blobsize2) }) {}
|
||||
params_tx_pool(crypto::hash hash, size_t blobsize) : txs{ tx_in_pool_info{ hash, blobsize } }
|
||||
{}
|
||||
params_tx_pool(crypto::hash hash1, size_t blobsize1, crypto::hash hash2, size_t blobsize2)
|
||||
{
|
||||
txs.push_back(tx_in_pool_info{ hash1, blobsize1 });
|
||||
txs.push_back(tx_in_pool_info{ hash2, blobsize2 });
|
||||
}
|
||||
|
||||
std::vector<tx_in_pool_info> txs;
|
||||
BEGIN_KV_SERIALIZE_MAP()
|
||||
|
|
|
|||
|
|
@ -989,7 +989,7 @@ bool pos_altblocks_validation::generate(std::vector<test_event_entry>& events) c
|
|||
// || \- (2a)- #3a#- | <- alt chain
|
||||
// |+--------------+ \ | \ PoS block 2a uses stake already spent in main chain (okay)
|
||||
// +---------------|-------+ \ PoS block 3a uses stake already spent in current alt chain (fail)
|
||||
// | \ \
|
||||
// | \ \
|
||||
// | \ ...... (2br)- (3b)- #4b# <- alt chain
|
||||
// | |
|
||||
// +-----------------------+ PoS block 3b uses as stake an output, created in current alt chain (2a)
|
||||
|
|
|
|||
|
|
@ -12,6 +12,8 @@
|
|||
class test_core_listener
|
||||
{
|
||||
public:
|
||||
virtual ~test_core_listener() = default;
|
||||
|
||||
virtual void before_tx_pushed_to_core(const currency::transaction& tx, const currency::blobdata& blob, currency::core& c, bool invalid_tx = false) {} // invalid_tx is true when processing a tx, marked as invalid in a test
|
||||
virtual void before_block_pushed_to_core(const currency::block& block, const currency::blobdata& blob, currency::core& c) {}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
add_executable(db_tests db_tests.cpp)
|
||||
target_link_libraries(db_tests crypto common lmdb ${Boost_LIBRARIES})
|
||||
target_link_libraries(db_tests crypto common lmdb zlib ${Boost_LIBRARIES})
|
||||
|
||||
|
|
|
|||
|
|
@ -264,7 +264,7 @@ TEST_F(positive_test_connection_to_levin_protocol_handler_calls, handler_initial
|
|||
TEST_F(positive_test_connection_to_levin_protocol_handler_calls, concurent_handler_initialization_and_destruction_is_correct)
|
||||
{
|
||||
const size_t connection_count = 10000;
|
||||
auto create_and_destroy_connections = [this, connection_count]()
|
||||
auto create_and_destroy_connections = [this]()
|
||||
{
|
||||
std::vector<test_connection_ptr> connections(connection_count);
|
||||
for (size_t i = 0; i < connection_count; ++i)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue