aboutsummaryrefslogtreecommitdiff
path: root/src/simplewallet/simplewallet.cpp
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2017-04-11 00:25:09 +0200
committerRiccardo Spagni <ric@spagni.net>2017-04-11 00:25:09 +0200
commit9c2bcabcddf292401ef36295814721b5a775b670 (patch)
tree5a0f04bb2606b0e8fbe5e799605f643234afdeec /src/simplewallet/simplewallet.cpp
parentMerge pull request #1948 (diff)
parentwallet2: do not go over the target tx size if many destinations (diff)
downloadmonero-9c2bcabcddf292401ef36295814721b5a775b670.tar.xz
Merge pull request #1949
0ee018b4 wallet2: do not go over the target tx size if many destinations (moneromooo-monero) 9ae566d0 simplewallet: fix cold signing of split transactions (moneromooo-monero) aae14a10 simplewallet: allow setting confirm-missing-payment-id in watch wallets (moneromooo-monero)
Diffstat (limited to 'src/simplewallet/simplewallet.cpp')
-rw-r--r--src/simplewallet/simplewallet.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/simplewallet/simplewallet.cpp b/src/simplewallet/simplewallet.cpp
index bb761c33e..e925e81b5 100644
--- a/src/simplewallet/simplewallet.cpp
+++ b/src/simplewallet/simplewallet.cpp
@@ -560,12 +560,6 @@ bool simple_wallet::set_refresh_type(const std::vector<std::string> &args/* = st
bool simple_wallet::set_confirm_missing_payment_id(const std::vector<std::string> &args/* = std::vector<std::string>()*/)
{
- if (m_wallet->watch_only())
- {
- fail_msg_writer() << tr("wallet is watch-only and cannot transfer");
- return true;
- }
-
const auto pwd_container = get_and_verify_password();
if (pwd_container)
{
@@ -2911,6 +2905,7 @@ bool simple_wallet::accept_loaded_tx(const std::function<size_t()> get_num_txes,
size_t min_mixin = ~0;
std::unordered_map<std::string, uint64_t> dests;
const std::string wallet_address = m_wallet->get_account().get_public_address_str(m_wallet->testnet());
+ int first_known_non_zero_change_index = -1;
for (size_t n = 0; n < get_num_txes(); ++n)
{
const tools::wallet2::tx_construction_data &cd = get_tx(n);
@@ -2945,10 +2940,15 @@ bool simple_wallet::accept_loaded_tx(const std::function<size_t()> get_num_txes,
fail_msg_writer() << tr("Claimed change is larger than payment to the change address");
return false;
}
- if (memcmp(&cd.change_dts.addr, &get_tx(0).change_dts.addr, sizeof(cd.change_dts.addr)))
+ if (cd.change_dts.amount > 0)
{
- fail_msg_writer() << tr("Change does to more than one address");
- return false;
+ if (first_known_non_zero_change_index == -1)
+ first_known_non_zero_change_index = n;
+ if (memcmp(&cd.change_dts.addr, &get_tx(first_known_non_zero_change_index).change_dts.addr, sizeof(cd.change_dts.addr)))
+ {
+ fail_msg_writer() << tr("Change goes to more than one address");
+ return false;
+ }
}
change += cd.change_dts.amount;
it->second -= cd.change_dts.amount;