aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/wallet2.cpp
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2016-11-05 10:28:25 +0200
committerRiccardo Spagni <ric@spagni.net>2016-11-05 10:28:25 +0200
commit1372f255af12564d41d8a9bbe247ce7b0fda78be (patch)
treef69531fa7ad225884267ac3e903203708036f31b /src/wallet/wallet2.cpp
parentMerge pull request #1272 (diff)
parentwallet: fix bad amounts/fees again (diff)
downloadmonero-1372f255af12564d41d8a9bbe247ce7b0fda78be.tar.xz
Merge pull request #1295
b5d6faa wallet: fix bad amounts/fees again (moneromooo-monero)
Diffstat (limited to '')
-rw-r--r--src/wallet/wallet2.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp
index 8ea605375..f57a8d2ca 100644
--- a/src/wallet/wallet2.cpp
+++ b/src/wallet/wallet2.cpp
@@ -704,6 +704,17 @@ void wallet2::process_outgoing(const cryptonote::transaction &tx, uint64_t heigh
else
entry.first->second.m_amount_out = spent - tx.rct_signatures.txnFee;
entry.first->second.m_change = received;
+
+ std::vector<tx_extra_field> tx_extra_fields;
+ if(parse_tx_extra(tx.extra, tx_extra_fields))
+ {
+ tx_extra_nonce extra_nonce;
+ if (find_tx_extra_field_by_type(tx_extra_fields, extra_nonce))
+ {
+ // we do not care about failure here
+ get_payment_id_from_tx_extra_nonce(extra_nonce.nonce, entry.first->second.m_payment_id);
+ }
+ }
}
entry.first->second.m_block_height = height;
entry.first->second.m_timestamp = ts;
@@ -2355,6 +2366,7 @@ void wallet2::add_unconfirmed_tx(const cryptonote::transaction& tx, uint64_t amo
utd.m_amount_out = 0;
for (const auto &d: dests)
utd.m_amount_out += d.amount;
+ utd.m_amount_out += change_amount;
utd.m_change = change_amount;
utd.m_sent_time = time(NULL);
utd.m_tx = (const cryptonote::transaction_prefix&)tx;