diff options
Diffstat (limited to 'src/wallet')
-rw-r--r-- | src/wallet/api/utils.cpp | 38 | ||||
-rw-r--r-- | src/wallet/wallet2.cpp | 5 | ||||
-rw-r--r-- | src/wallet/wallet_args.cpp | 5 | ||||
-rw-r--r-- | src/wallet/wallet_args.h | 3 | ||||
-rw-r--r-- | src/wallet/wallet_rpc_server.cpp | 6 |
5 files changed, 12 insertions, 45 deletions
diff --git a/src/wallet/api/utils.cpp b/src/wallet/api/utils.cpp index 0d30b61cd..788d98f25 100644 --- a/src/wallet/api/utils.cpp +++ b/src/wallet/api/utils.cpp @@ -31,50 +31,16 @@ #include "include_base_utils.h" // LOG_PRINT_x -#include "net/http_client.h" // epee::net_utils::... -#include <boost/asio.hpp> +#include "common/util.h" using namespace std; namespace Monero { namespace Utils { - -// copy-pasted from simplewallet. - bool isAddressLocal(const std::string &address) { - // extract host - epee::net_utils::http::url_content u_c; - if (!epee::net_utils::parse_url(address, u_c)) - { - LOG_PRINT_L1("Failed to determine whether daemon is local, assuming not"); - return false; - } - if (u_c.host.empty()) - { - LOG_PRINT_L1("Failed to determine whether daemon is local, assuming not"); - return false; - } - // resolver::resolve can throw an exception - try { - // resolve to IP - boost::asio::io_service io_service; - boost::asio::ip::tcp::resolver resolver(io_service); - boost::asio::ip::tcp::resolver::query query(u_c.host, "", boost::asio::ip::tcp::resolver::query::canonical_name); - boost::asio::ip::tcp::resolver::iterator i = resolver.resolve(query); - while (i != boost::asio::ip::tcp::resolver::iterator()) - { - const boost::asio::ip::tcp::endpoint &ep = *i; - if (ep.address().is_loopback()) - return true; - ++i; - } - } catch (const boost::system::system_error &e) { - LOG_ERROR("Failed to resolve " << address << ", :" << e.what()); - } - - return false; + return tools::is_local_address(address); } } diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index 9fd98056a..148fb9d52 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -3007,7 +3007,7 @@ void wallet2::commit_tx(pending_tx& ptx) } //fee includes dust if dust policy specified it. - LOG_PRINT_L0("Transaction successfully sent. <" << txid << ">" << ENDL + LOG_PRINT_L1("Transaction successfully sent. <" << txid << ">" << ENDL << "Commission: " << print_money(ptx.fee) << " (dust sent to dust addr: " << print_money((ptx.dust_added_to_fee ? 0 : ptx.dust)) << ")" << ENDL << "Balance: " << print_money(balance()) << ENDL << "Unlocked: " << print_money(unlocked_balance()) << ENDL @@ -4112,7 +4112,8 @@ std::vector<wallet2::pending_tx> wallet2::create_transactions_2(std::vector<cryp THROW_WALLET_EXCEPTION_IF(needed_money == 0, error::zero_destination); // gather all our dust and non dust outputs - for (size_t i = 0; i < m_transfers.size(); ++i) + const std::vector<size_t> unused_indices = select_available_outputs_from_histogram(fake_outs_count + 1, true, true, trusted_daemon); + for (size_t i: unused_indices) { const transfer_details& td = m_transfers[i]; if (!td.m_spent && (use_rct ? true : !td.is_rct()) && is_transfer_unlocked(td)) diff --git a/src/wallet/wallet_args.cpp b/src/wallet/wallet_args.cpp index b7a4532fd..12799f613 100644 --- a/src/wallet/wallet_args.cpp +++ b/src/wallet/wallet_args.cpp @@ -72,7 +72,8 @@ namespace wallet_args int argc, char** argv, const char* const usage, boost::program_options::options_description desc_params, - const boost::program_options::positional_options_description& positional_options) + const boost::program_options::positional_options_description& positional_options, + bool log_to_console) { namespace bf = boost::filesystem; @@ -138,7 +139,7 @@ namespace wallet_args log_path = command_line::get_arg(vm, arg_log_file); else log_path = mlog_get_default_log_path("monero-wallet-cli.log"); - mlog_configure(log_path, false); + mlog_configure(log_path, log_to_console); if (!vm["log-level"].defaulted()) { mlog_set_log(command_line::get_arg(vm, arg_log_level).c_str()); diff --git a/src/wallet/wallet_args.h b/src/wallet/wallet_args.h index 17446abf3..e0719d203 100644 --- a/src/wallet/wallet_args.h +++ b/src/wallet/wallet_args.h @@ -49,5 +49,6 @@ namespace wallet_args int argc, char** argv, const char* const usage, boost::program_options::options_description desc_params, - const boost::program_options::positional_options_description& positional_options); + const boost::program_options::positional_options_description& positional_options, + bool log_to_console = false); } diff --git a/src/wallet/wallet_rpc_server.cpp b/src/wallet/wallet_rpc_server.cpp index d35e51068..dcf8f8e6d 100644 --- a/src/wallet/wallet_rpc_server.cpp +++ b/src/wallet/wallet_rpc_server.cpp @@ -1324,16 +1324,14 @@ int main(int argc, char** argv) { argc, argv, "monero-wallet-rpc [--wallet-file=<file>|--generate-from-json=<file>] [--rpc-bind-port=<port>]", desc_params, - po::positional_options_description() + po::positional_options_description(), + true ); if (!vm) { return 1; } - mlog_configure("monero-wallet-rpc.log", true); - mlog_set_log_level(2); - std::unique_ptr<tools::wallet2> wal; try { |