From 58931cb77b3d09d4b3ad6b4142fcc9964f3c6227 Mon Sep 17 00:00:00 2001 From: cryptozoidberg Date: Tue, 22 Mar 2022 23:38:43 +0200 Subject: [PATCH] added status feedback from wallet\tor layer --- src/simplewallet/simplewallet.cpp | 5 +++++ src/simplewallet/simplewallet.h | 1 + src/wallet/wallet2.cpp | 9 ++++++--- src/wallet/wallet2.h | 1 + 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/simplewallet/simplewallet.cpp b/src/simplewallet/simplewallet.cpp index cfb48a64..3e1c7504 100644 --- a/src/simplewallet/simplewallet.cpp +++ b/src/simplewallet/simplewallet.cpp @@ -658,6 +658,11 @@ void simple_wallet::on_message(i_wallet2_callback::message_severity severity, co message_writer(color, true, std::string()) << m; } //---------------------------------------------------------------------------------------------------- +void simple_wallet::on_tor_status_change(const std::string& state) +{ + message_writer(epee::log_space::console_color_yellow, false, std::string("TOR")) << state; +} +//---------------------------------------------------------------------------------------------------- bool simple_wallet::refresh(const std::vector& args) { if (m_offline_mode) diff --git a/src/simplewallet/simplewallet.h b/src/simplewallet/simplewallet.h index 35f99128..c0c0124d 100644 --- a/src/simplewallet/simplewallet.h +++ b/src/simplewallet/simplewallet.h @@ -98,6 +98,7 @@ namespace currency virtual void on_new_block(uint64_t height, const currency::block& block) override; virtual void on_transfer2(const tools::wallet_public::wallet_transfer_info& wti, uint64_t balance, uint64_t unlocked_balance, uint64_t total_mined) override; virtual void on_message(i_wallet2_callback::message_severity severity, const std::string& m) override; + virtual void on_tor_status_change(const std::string& state) override; //---------------------------------------------------------- diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index c36a8fc6..62ad07c3 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -32,6 +32,8 @@ using namespace epee; #include "common/encryption_filter.h" #include "crypto/bitcoin/sha256_helper.h" #include "common/tor_helper.h" +#include "storages/levin_abstract_invoke2.h" + using namespace currency; @@ -4619,9 +4621,10 @@ void wallet2::send_transaction_to_network(const transaction& tx) currency::NOTIFY_OR_INVOKE_NEW_TRANSACTIONS::request p2p_req = AUTO_VAL_INIT(p2p_req); currency::NOTIFY_OR_INVOKE_NEW_TRANSACTIONS::response p2p_rsp = AUTO_VAL_INIT(p2p_rsp); p2p_req.txs.push_back(t_serializable_object_to_blob(tx)); - std::string blob; - epee::serialization::store_t_to_binary(p2p_req, blob); - p2p_client.invoke(NOTIFY_OR_INVOKE_NEW_TRANSACTIONS::ID, blob); + //std::string blob; + //epee::serialization::store_t_to_binary(p2p_req, blob); + epee::net_utils::invoke_remote_command2(NOTIFY_OR_INVOKE_NEW_TRANSACTIONS::ID, p2p_req, p2p_rsp, p2p_client); + //p2p_client.invoke(NOTIFY_OR_INVOKE_NEW_TRANSACTIONS::ID, blob,m ); p2p_client.disconnect(); //checking if transaction got relayed to other nodes and diff --git a/src/wallet/wallet2.h b/src/wallet/wallet2.h index f4f4736d..e57ff79a 100644 --- a/src/wallet/wallet2.h +++ b/src/wallet/wallet2.h @@ -41,6 +41,7 @@ #include "currency_core/bc_escrow_service.h" #include "common/pod_array_file_container.h" #include "wallet_chain_shortener.h" +#include "tor-connect/torlib/tor_lib_iface.h" #define WALLET_DEFAULT_TX_SPENDABLE_AGE 10