aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/api
diff options
context:
space:
mode:
Diffstat (limited to 'src/wallet/api')
-rw-r--r--src/wallet/api/transaction_history.cpp5
-rw-r--r--src/wallet/api/wallet.cpp12
2 files changed, 4 insertions, 13 deletions
diff --git a/src/wallet/api/transaction_history.cpp b/src/wallet/api/transaction_history.cpp
index db42e2141..95aafb04f 100644
--- a/src/wallet/api/transaction_history.cpp
+++ b/src/wallet/api/transaction_history.cpp
@@ -165,9 +165,8 @@ void TransactionHistoryImpl::refresh()
for (std::list<std::pair<crypto::hash, tools::wallet2::unconfirmed_transfer_details>>::const_iterator i = upayments.begin(); i != upayments.end(); ++i) {
const tools::wallet2::unconfirmed_transfer_details &pd = i->second;
const crypto::hash &hash = i->first;
- uint64_t amount = 0;
- cryptonote::get_inputs_money_amount(pd.m_tx, amount);
- uint64_t fee = amount - get_outs_money_amount(pd.m_tx);
+ uint64_t amount = pd.m_amount_in;
+ uint64_t fee = amount - pd.m_amount_out;
std::string payment_id = string_tools::pod_to_hex(i->second.m_payment_id);
if (payment_id.substr(16).find_first_not_of('0') == std::string::npos)
payment_id = payment_id.substr(0,16);
diff --git a/src/wallet/api/wallet.cpp b/src/wallet/api/wallet.cpp
index b3ee4112b..f8704fde3 100644
--- a/src/wallet/api/wallet.cpp
+++ b/src/wallet/api/wallet.cpp
@@ -79,11 +79,10 @@ struct Wallet2CallbackImpl : public tools::i_wallet2_callback
LOG_PRINT_L3(__FUNCTION__ << ": new block. height: " << height);
}
- virtual void on_money_received(uint64_t height, const cryptonote::transaction& tx, size_t out_index)
+ virtual void on_money_received(uint64_t height, const cryptonote::transaction& tx, uint64_t amount)
{
std::string tx_hash = epee::string_tools::pod_to_hex(get_transaction_hash(tx));
- uint64_t amount = tx.vout[out_index].amount;
LOG_PRINT_L3(__FUNCTION__ << ": money received. height: " << height
<< ", tx: " << tx_hash
@@ -94,12 +93,11 @@ struct Wallet2CallbackImpl : public tools::i_wallet2_callback
}
}
- virtual void on_money_spent(uint64_t height, const cryptonote::transaction& in_tx, size_t out_index,
+ virtual void on_money_spent(uint64_t height, const cryptonote::transaction& in_tx, uint64_t amount,
const cryptonote::transaction& spend_tx)
{
// TODO;
std::string tx_hash = epee::string_tools::pod_to_hex(get_transaction_hash(spend_tx));
- uint64_t amount = in_tx.vout[out_index].amount;
LOG_PRINT_L3(__FUNCTION__ << ": money spent. height: " << height
<< ", tx: " << tx_hash
<< ", amount: " << print_money(amount));
@@ -491,12 +489,6 @@ PendingTransaction *WalletImpl::createTransaction(const string &dst_addr, const
}
de.amount = amount;
- if (de.amount <= 0) {
- m_status = Status_Error;
- m_errorString = "Invalid amount";
- break;
- }
-
dsts.push_back(de);
//std::vector<tools::wallet2::pending_tx> ptx_vector;