From d004de22d2d822a3d39a9643f93dbb38d07a3b0a Mon Sep 17 00:00:00 2001 From: woodser Date: Thu, 1 Aug 2019 09:11:28 -0400 Subject: [PATCH] implement outgoing transfer notifications --- src/wallet/MoneroWallet.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/wallet/MoneroWallet.cpp b/src/wallet/MoneroWallet.cpp index f2c44b2..4d75727 100644 --- a/src/wallet/MoneroWallet.cpp +++ b/src/wallet/MoneroWallet.cpp @@ -734,14 +734,14 @@ namespace monero { listener->onIncomingTransfer(*transfer); } - virtual void on_money_spent(uint64_t height, const crypto::hash &txid, const cryptonote::transaction& in_tx, uint64_t amount, const cryptonote::transaction& spend_tx, const cryptonote::subaddress_index& subaddr_index) { + virtual void on_money_spent(uint64_t height, const crypto::hash &txid, const cryptonote::transaction& cnTxIn, uint64_t amount, const cryptonote::transaction& cnTxOut, const cryptonote::subaddress_index& subaddr_index) { MTRACE("Wallet2Listener::on_money_spent()"); + if (&cnTxIn != &cnTxOut) throw runtime_error("on_money_spent() in tx is different than out tx"); // create native library tx - // TODO **: fill this out shared_ptr block = make_shared(); block->height = height; - shared_ptr tx = make_shared(); + shared_ptr tx = static_pointer_cast(MoneroUtils::cnTxToTx(cnTxIn, true)); block->txs.push_back(tx); tx->block = block; tx->id = epee::string_tools::pod_to_hex(txid); @@ -749,6 +749,8 @@ namespace monero { tx->outgoingTransfer = transfer; transfer->tx = tx; transfer->amount = amount; + transfer->accountIndex = subaddr_index.major; + transfer->subaddressIndices.push_back(subaddr_index.minor); // notify listener of transfer listener->onOutgoingTransfer(*transfer);