diff options
Diffstat (limited to 'src/wallet/wallet2.cpp')
-rw-r--r-- | src/wallet/wallet2.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index ef77f68c3..d5645bd1f 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -228,6 +228,7 @@ void wallet2::process_new_transaction(const cryptonote::transaction& tx, uint64_ return; } + int num_vouts_received = 0; tx_pub_key = pub_key_field.pub_key; bool r = true; std::deque<cryptonote::keypair> in_ephemeral(tx.vout.size()); @@ -262,6 +263,7 @@ void wallet2::process_new_transaction(const cryptonote::transaction& tx, uint64_ money_transfered = tools::decodeRct(tx.rct_signatures, rct::sk2rct(in_ephemeral[0].sec), 0, mask[0]); amount[0] = money_transfered; tx_money_got_in_outs = money_transfered; + ++num_vouts_received; // process the other outs from that tx boost::asio::io_service ioservice; @@ -301,6 +303,7 @@ void wallet2::process_new_transaction(const cryptonote::transaction& tx, uint64_ money_transfered[i] = tools::decodeRct(tx.rct_signatures, rct::sk2rct(in_ephemeral[i].sec), i, mask[i]); tx_money_got_in_outs += money_transfered[i]; amount[i] = money_transfered[i]; + ++num_vouts_received; } } } @@ -345,6 +348,7 @@ void wallet2::process_new_transaction(const cryptonote::transaction& tx, uint64_ money_transfered[i] = tools::decodeRct(tx.rct_signatures, rct::sk2rct(in_ephemeral[i].sec), i, mask[i]); tx_money_got_in_outs += money_transfered[i]; amount[i] = money_transfered[i]; + ++num_vouts_received; } } } @@ -373,13 +377,14 @@ void wallet2::process_new_transaction(const cryptonote::transaction& tx, uint64_ money_transfered = tools::decodeRct(tx.rct_signatures, rct::sk2rct(in_ephemeral[i].sec), i, mask[i]); amount[i] = money_transfered; tx_money_got_in_outs += money_transfered; + ++num_vouts_received; } } } } THROW_WALLET_EXCEPTION_IF(!r, error::acc_outs_lookup_error, tx, tx_pub_key, m_account.get_keys()); - if(!outs.empty() && tx_money_got_in_outs) + if(!outs.empty() && num_vouts_received > 0) { //good news - got money! take care about it //usually we have only one transfer for user in transaction @@ -2969,12 +2974,8 @@ void wallet2::transfer_selected_rct(std::vector<cryptonote::tx_destination_entry } cryptonote::tx_destination_entry change_dts = AUTO_VAL_INIT(change_dts); - if (needed_money < found_money) - { - change_dts.addr = m_account.get_keys().m_account_address; - change_dts.amount = found_money - needed_money; - } - + change_dts.addr = m_account.get_keys().m_account_address; + change_dts.amount = found_money - needed_money; // may be 0, we allow 0 change dsts.push_back(change_dts); crypto::secret_key tx_key; |