aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/wallet2.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/wallet/wallet2.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp
index 788f96415..f01373644 100644
--- a/src/wallet/wallet2.cpp
+++ b/src/wallet/wallet2.cpp
@@ -270,7 +270,14 @@ void wallet2::process_new_transaction(const cryptonote::transaction& tx, uint64_
LOG_PRINT_L2("Found unencrypted payment ID: " << payment_id);
}
}
+
uint64_t received = (tx_money_spent_in_ins < tx_money_got_in_outs) ? tx_money_got_in_outs - tx_money_spent_in_ins : 0;
+
+ if (tx_money_spent_in_ins > 0)
+ {
+ process_outgoing(tx, height, tx_money_spent_in_ins, tx_money_got_in_outs);
+ }
+
if (0 < received)
{
payment_details payment;
@@ -301,6 +308,18 @@ void wallet2::process_unconfirmed(const cryptonote::transaction& tx, uint64_t he
}
}
//----------------------------------------------------------------------------------------------------
+void wallet2::process_outgoing(const cryptonote::transaction &tx, uint64_t height, uint64_t spent, uint64_t received)
+{
+ crypto::hash txid = get_transaction_hash(tx);
+ confirmed_transfer_details &ctd = m_confirmed_txs[txid];
+ // operator[] creates if not found
+ // fill with the info we know, some info might already be there
+ ctd.m_amount_in = spent;
+ ctd.m_amount_out = get_outs_money_amount(tx);
+ ctd.m_change = received;
+ ctd.m_block_height = height;
+}
+//----------------------------------------------------------------------------------------------------
void wallet2::process_new_blockchain_entry(const cryptonote::block& b, cryptonote::block_complete_entry& bche, crypto::hash& bl_id, uint64_t height)
{
//handle transactions from new block