From 2b0f34a77e1b4ba5a4c446cc9c805e6ee2beb0e0 Mon Sep 17 00:00:00 2001 From: woodser Date: Fri, 2 Aug 2019 14:55:35 -0400 Subject: [PATCH] switch transfer notifications to output notifications --- src/wallet/MoneroWallet.cpp | 32 ++++++++++++++++---------------- src/wallet/MoneroWallet.h | 12 ++++++------ 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/wallet/MoneroWallet.cpp b/src/wallet/MoneroWallet.cpp index 4d75727..c0d76b6 100644 --- a/src/wallet/MoneroWallet.cpp +++ b/src/wallet/MoneroWallet.cpp @@ -723,15 +723,15 @@ namespace monero { tx->block = block; tx->id = epee::string_tools::pod_to_hex(txid); tx->unlockTime = unlock_time; - shared_ptr transfer = make_shared(); - tx->incomingTransfers.push_back(transfer); - transfer->tx = tx; - transfer->amount = amount; - transfer->accountIndex = subaddr_index.major; - transfer->subaddressIndex = subaddr_index.minor; + shared_ptr output = make_shared(); + tx->vouts.push_back(output); + output->tx = tx; + output->amount = amount; + output->accountIndex = subaddr_index.major; + output->subaddressIndex = subaddr_index.minor; - // notify listener of transfer - listener->onIncomingTransfer(*transfer); + // notify listener of output + listener->onOutputReceived(*output); } 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) { @@ -745,15 +745,15 @@ namespace monero { block->txs.push_back(tx); tx->block = block; tx->id = epee::string_tools::pod_to_hex(txid); - shared_ptr transfer = make_shared(); - tx->outgoingTransfer = transfer; - transfer->tx = tx; - transfer->amount = amount; - transfer->accountIndex = subaddr_index.major; - transfer->subaddressIndices.push_back(subaddr_index.minor); + shared_ptr output = make_shared(); + tx->vins.push_back(output); + output->tx = tx; + output->amount = amount; + output->accountIndex = subaddr_index.major; + output->subaddressIndex = subaddr_index.minor; - // notify listener of transfer - listener->onOutgoingTransfer(*transfer); + // notify listener of output + listener->onOutputSpent(*output); // TODO **: to notify or not to notify? // std::string tx_hash = epee::string_tools::pod_to_hex(txid); diff --git a/src/wallet/MoneroWallet.h b/src/wallet/MoneroWallet.h index 26a8b5a..4225b93 100644 --- a/src/wallet/MoneroWallet.h +++ b/src/wallet/MoneroWallet.h @@ -129,18 +129,18 @@ namespace monero { virtual void onNewBlock(uint64_t height) {}; /** - * Invoked when the wallet receives an incoming transfer. + * Invoked when the wallet receives an output. * - * @param transfer is the incoming transfer to the wallet + * @param output is the incoming output to the wallet */ - virtual void onIncomingTransfer(const MoneroIncomingTransfer& transfer) {}; + virtual void onOutputReceived(const MoneroOutputWallet& output) {}; /** - * Invoked when the wallet sends an outgoing transfer. + * Invoked when the wallet spends an output. * - * @param transfer is the outgoing transfer from the wallet + * @param output the outgoing transfer from the wallet */ - virtual void onOutgoingTransfer(const MoneroOutgoingTransfer& transfer) {}; + virtual void onOutputSpent(const MoneroOutputWallet& output) {}; }; // forward declaration of internal wallet2 listener