diff options
author | Riccardo Spagni <ric@spagni.net> | 2018-01-27 17:24:15 -0800 |
---|---|---|
committer | Riccardo Spagni <ric@spagni.net> | 2018-01-27 17:24:15 -0800 |
commit | 73a19e0b067c240bc048bd7a14c7b6f1a6a00e3d (patch) | |
tree | 206472869db99d7b2fdebdb9277c8dd343eaab67 /src/wallet/wallet2.cpp | |
parent | Merge pull request #3104 (diff) | |
parent | wallet rpc: show fees when querying incoming transfers (diff) | |
download | monero-73a19e0b067c240bc048bd7a14c7b6f1a6a00e3d.tar.xz |
Merge pull request #3113
ffc2e570 wallet rpc: show fees when querying incoming transfers (stoffu)
Diffstat (limited to 'src/wallet/wallet2.cpp')
-rw-r--r-- | src/wallet/wallet2.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index dcec64a97..3a7dad925 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -1331,6 +1331,8 @@ void wallet2::process_new_transaction(const crypto::hash &txid, const cryptonote } } + uint64_t fee = miner_tx ? 0 : tx.version == 1 ? tx_money_spent_in_ins - get_outs_money_amount(tx) : tx.rct_signatures.txnFee; + if (tx_money_spent_in_ins > 0 && !pool) { uint64_t self_received = std::accumulate<decltype(tx_money_got_in_outs.begin()), uint64_t>(tx_money_got_in_outs.begin(), tx_money_got_in_outs.end(), 0, @@ -1340,7 +1342,6 @@ void wallet2::process_new_transaction(const crypto::hash &txid, const cryptonote }); process_outgoing(txid, tx, height, ts, tx_money_spent_in_ins, self_received, *subaddr_account, subaddr_indices); // if sending to yourself at the same subaddress account, set the outgoing payment amount to 0 so that it's less confusing - uint64_t fee = tx.version == 1 ? tx_money_spent_in_ins - get_outs_money_amount(tx) : tx.rct_signatures.txnFee; if (tx_money_spent_in_ins == self_received + fee) { auto i = m_confirmed_txs.find(txid); @@ -1405,6 +1406,7 @@ void wallet2::process_new_transaction(const crypto::hash &txid, const cryptonote { payment_details payment; payment.m_tx_hash = txid; + payment.m_fee = fee; payment.m_amount = i.second; payment.m_block_height = height; payment.m_unlock_time = tx.unlock_time; @@ -6309,6 +6311,7 @@ void wallet2::light_wallet_get_address_txs() address_tx.m_tx_hash = tx_hash; address_tx.m_incoming = incoming; address_tx.m_amount = incoming ? total_received - total_sent : total_sent - total_received; + address_tx.m_fee = 0; // TODO address_tx.m_block_height = t.height; address_tx.m_unlock_time = t.unlock_time; address_tx.m_timestamp = t.timestamp; @@ -6322,6 +6325,7 @@ void wallet2::light_wallet_get_address_txs() payment_details payment; payment.m_tx_hash = tx_hash; payment.m_amount = total_received - total_sent; + payment.m_fee = 0; // TODO payment.m_block_height = t.height; payment.m_unlock_time = t.unlock_time; payment.m_timestamp = t.timestamp; |