diff options
Diffstat (limited to 'src/simplewallet/simplewallet.cpp')
-rw-r--r-- | src/simplewallet/simplewallet.cpp | 53 |
1 files changed, 27 insertions, 26 deletions
diff --git a/src/simplewallet/simplewallet.cpp b/src/simplewallet/simplewallet.cpp index 421d1f53a..279a5fa41 100644 --- a/src/simplewallet/simplewallet.cpp +++ b/src/simplewallet/simplewallet.cpp @@ -502,10 +502,10 @@ bool simple_wallet::set_default_mixin(const std::vector<std::string> &args/* = s } } -bool simple_wallet::set_default_fee_multiplier(const std::vector<std::string> &args/* = std::vector<std::string>()*/) +bool simple_wallet::set_default_priority(const std::vector<std::string> &args/* = std::vector<std::string>()*/) { bool success = false; - int fee_multiplier = 0; + int priority = 0; if (m_wallet->watch_only()) { fail_msg_writer() << tr("wallet is watch-only and cannot transfer"); @@ -515,19 +515,19 @@ bool simple_wallet::set_default_fee_multiplier(const std::vector<std::string> &a { if (strchr(args[1].c_str(), '-')) { - fail_msg_writer() << tr("fee multiplier must be 0, 1, 2, or 3 "); + fail_msg_writer() << tr("priority must be 0, 1, 2, or 3 "); return true; } if (args[1] == "0") { - fee_multiplier = 0; + priority = 0; } else { - fee_multiplier = boost::lexical_cast<int>(args[1]); - if (fee_multiplier != 1 && fee_multiplier != 2 && fee_multiplier != 3) + priority = boost::lexical_cast<int>(args[1]); + if (priority != 1 && priority != 2 && priority != 3) { - fail_msg_writer() << tr("fee multiplier must be 0, 1, 2, or 3"); + fail_msg_writer() << tr("priority must be 0, 1, 2, or 3"); return true; } } @@ -548,18 +548,18 @@ bool simple_wallet::set_default_fee_multiplier(const std::vector<std::string> &a return true; } - m_wallet->set_default_fee_multiplier(fee_multiplier); + m_wallet->set_default_priority(priority); m_wallet->rewrite(m_wallet_file, pwd_container.password()); return true; } catch(const boost::bad_lexical_cast &) { - fail_msg_writer() << tr("fee multiplier must be 0, 1, 2 or 3"); + fail_msg_writer() << tr("priority must be 0, 1, 2 or 3"); return true; } catch(...) { - fail_msg_writer() << tr("could not change default fee multiplier"); + fail_msg_writer() << tr("could not change default priority"); return true; } } @@ -662,7 +662,7 @@ simple_wallet::simple_wallet() m_cmd_binder.set_handler("viewkey", boost::bind(&simple_wallet::viewkey, this, _1), tr("Display private view key")); m_cmd_binder.set_handler("spendkey", boost::bind(&simple_wallet::spendkey, this, _1), tr("Display private spend key")); m_cmd_binder.set_handler("seed", boost::bind(&simple_wallet::seed, this, _1), tr("Display Electrum-style mnemonic seed")); - m_cmd_binder.set_handler("set", boost::bind(&simple_wallet::set_variable, this, _1), tr("Available options: seed language - set wallet seed language; always-confirm-transfers <1|0> - whether to confirm unsplit txes; store-tx-info <1|0> - whether to store outgoing tx info (destination address, payment ID, tx secret key) for future reference; default-mixin <n> - set default mixin (default default is 4); auto-refresh <1|0> - whether to automatically sync new blocks from the daemon; refresh-type <full|optimize-coinbase|no-coinbase|default> - set wallet refresh behaviour; fee-multiplier [1|2|3] - normal/elevated/priority fee")); + m_cmd_binder.set_handler("set", boost::bind(&simple_wallet::set_variable, this, _1), tr("Available options: seed language - set wallet seed language; always-confirm-transfers <1|0> - whether to confirm unsplit txes; store-tx-info <1|0> - whether to store outgoing tx info (destination address, payment ID, tx secret key) for future reference; default-mixin <n> - set default mixin (default is 4); auto-refresh <1|0> - whether to automatically sync new blocks from the daemon; refresh-type <full|optimize-coinbase|no-coinbase|default> - set wallet refresh behaviour; priority [1|2|3] - normal/elevated/priority fee")); m_cmd_binder.set_handler("rescan_spent", boost::bind(&simple_wallet::rescan_spent, this, _1), tr("Rescan blockchain for spent outputs")); m_cmd_binder.set_handler("get_tx_key", boost::bind(&simple_wallet::get_tx_key, this, _1), tr("Get transaction key (r) for a given <txid>")); m_cmd_binder.set_handler("check_tx_key", boost::bind(&simple_wallet::check_tx_key, this, _1), tr("Check amount going to <address> in <txid>")); @@ -688,7 +688,7 @@ bool simple_wallet::set_variable(const std::vector<std::string> &args) success_msg_writer() << "default-mixin = " << m_wallet->default_mixin(); success_msg_writer() << "auto-refresh = " << m_wallet->auto_refresh(); success_msg_writer() << "refresh-type = " << get_refresh_type_name(m_wallet->get_refresh_type()); - success_msg_writer() << "fee-multiplier = " << m_wallet->get_default_fee_multiplier(); + success_msg_writer() << "priority = " << m_wallet->get_default_priority(); return true; } else @@ -784,18 +784,18 @@ bool simple_wallet::set_variable(const std::vector<std::string> &args) return true; } } - else if (args[0] == "fee-multiplier") + else if (args[0] == "priority") { if (args.size() <= 1) { - fail_msg_writer() << tr("set fee-multiplier: needs an argument: 0, 1, 2, or 3"); + fail_msg_writer() << tr("set priority: needs an argument: 0, 1, 2, or 3"); return true; } else { std::vector<std::string> local_args = args; local_args.erase(local_args.begin(), local_args.begin()+2); - set_default_fee_multiplier(local_args); + set_default_priority(local_args); return true; } } @@ -2484,11 +2484,12 @@ bool simple_wallet::transfer_main(int transfer_type, const std::vector<std::stri } catch (const tools::error::not_enough_money& e) { - fail_msg_writer() << boost::format(tr("not enough money to transfer, available only %s, transaction amount %s = %s + %s (fee)")) % + LOG_PRINT_L0(boost::format("not enough money to transfer, available only %s, transaction amount %s = %s + %s (fee)") % print_money(e.available()) % print_money(e.tx_amount() + e.fee()) % print_money(e.tx_amount()) % - print_money(e.fee()); + print_money(e.fee())); + fail_msg_writer() << tr("Failed to find a way to create transactions. This is usually due to dust which is so small it cannot pay for itself in fees"); } catch (const tools::error::not_enough_outs_to_mix& e) { @@ -2645,12 +2646,12 @@ bool simple_wallet::sweep_unmixable(const std::vector<std::string> &args_) } catch (const tools::error::not_enough_money& e) { - fail_msg_writer() << boost::format(tr("not enough money to transfer, available only %s, transaction amount %s = %s + %s (fee).\n%s")) % + LOG_PRINT_L0(boost::format("not enough money to transfer, available only %s, transaction amount %s = %s + %s (fee)") % print_money(e.available()) % - print_money(e.tx_amount() + e.fee()) % + print_money(e.tx_amount() + e.fee()) % print_money(e.tx_amount()) % - print_money(e.fee()) % - tr("This is usually due to dust which is so small it cannot pay for itself in fees"); + print_money(e.fee())); + fail_msg_writer() << tr("Failed to find a way to create transactions. This is usually due to dust which is so small it cannot pay for itself in fees"); } catch (const tools::error::not_enough_outs_to_mix& e) { @@ -2877,12 +2878,12 @@ bool simple_wallet::sweep_all(const std::vector<std::string> &args_) } catch (const tools::error::not_enough_money& e) { - fail_msg_writer() << boost::format(tr("not enough money to transfer, available only %s, transaction amount %s = %s + %s (fee).\n%s")) % + LOG_PRINT_L0(boost::format("not enough money to transfer, available only %s, transaction amount %s = %s + %s (fee)") % print_money(e.available()) % - print_money(e.tx_amount() + e.fee()) % + print_money(e.tx_amount() + e.fee()) % print_money(e.tx_amount()) % - print_money(e.fee()) % - tr("This is usually due to dust which is so small it cannot pay for itself in fees"); + print_money(e.fee())); + fail_msg_writer() << tr("Failed to find a way to create transactions. This is usually due to dust which is so small it cannot pay for itself in fees"); } catch (const tools::error::not_enough_outs_to_mix& e) { @@ -3305,7 +3306,7 @@ bool simple_wallet::show_transfers(const std::vector<std::string> &args_) for (std::list<std::pair<crypto::hash, tools::wallet2::unconfirmed_transfer_details>>::const_iterator i = upayments.begin(); i != upayments.end(); ++i) { const tools::wallet2::unconfirmed_transfer_details &pd = i->second; uint64_t amount = pd.m_amount_in; - uint64_t fee = amount - pd.m_amount_out; + uint64_t fee = amount - pd.m_amount_out - pd.m_change; std::string payment_id = string_tools::pod_to_hex(i->second.m_payment_id); if (payment_id.substr(16).find_first_not_of('0') == std::string::npos) payment_id = payment_id.substr(0,16); |