mirror of
https://github.com/monero-project/monero.git
synced 2024-12-13 20:06:32 +02:00
wallet rpc: show fees when querying incoming transfers
This commit is contained in:
parent
09d19c9139
commit
ffc2e5705d
@ -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;
|
||||
|
@ -252,6 +252,7 @@ namespace tools
|
||||
{
|
||||
crypto::hash m_tx_hash;
|
||||
uint64_t m_amount;
|
||||
uint64_t m_fee;
|
||||
uint64_t m_block_height;
|
||||
uint64_t m_unlock_time;
|
||||
uint64_t m_timestamp;
|
||||
@ -1144,7 +1145,7 @@ BOOST_CLASS_VERSION(tools::wallet2::transfer_details, 9)
|
||||
BOOST_CLASS_VERSION(tools::wallet2::multisig_info, 1)
|
||||
BOOST_CLASS_VERSION(tools::wallet2::multisig_info::LR, 0)
|
||||
BOOST_CLASS_VERSION(tools::wallet2::multisig_tx_set, 1)
|
||||
BOOST_CLASS_VERSION(tools::wallet2::payment_details, 2)
|
||||
BOOST_CLASS_VERSION(tools::wallet2::payment_details, 3)
|
||||
BOOST_CLASS_VERSION(tools::wallet2::pool_payment_details, 1)
|
||||
BOOST_CLASS_VERSION(tools::wallet2::unconfirmed_transfer_details, 7)
|
||||
BOOST_CLASS_VERSION(tools::wallet2::confirmed_transfer_details, 5)
|
||||
@ -1409,6 +1410,12 @@ namespace boost
|
||||
return;
|
||||
}
|
||||
a & x.m_subaddr_index;
|
||||
if (ver < 3)
|
||||
{
|
||||
x.m_fee = 0;
|
||||
return;
|
||||
}
|
||||
a & x.m_fee;
|
||||
}
|
||||
|
||||
template <class Archive>
|
||||
|
@ -254,7 +254,7 @@ namespace tools
|
||||
entry.timestamp = pd.m_timestamp;
|
||||
entry.amount = pd.m_amount;
|
||||
entry.unlock_time = pd.m_unlock_time;
|
||||
entry.fee = 0; // TODO
|
||||
entry.fee = pd.m_fee;
|
||||
entry.note = m_wallet->get_tx_note(pd.m_tx_hash);
|
||||
entry.type = "in";
|
||||
entry.subaddr_index = pd.m_subaddr_index;
|
||||
@ -317,7 +317,7 @@ namespace tools
|
||||
entry.timestamp = pd.m_timestamp;
|
||||
entry.amount = pd.m_amount;
|
||||
entry.unlock_time = pd.m_unlock_time;
|
||||
entry.fee = 0; // TODO
|
||||
entry.fee = pd.m_fee;
|
||||
entry.note = m_wallet->get_tx_note(pd.m_tx_hash);
|
||||
entry.double_spend_seen = ppd.m_double_spend_seen;
|
||||
entry.type = "pool";
|
||||
|
Loading…
Reference in New Issue
Block a user