From 28c053aa975fa8a830dd53636ccd27b5f20bbbff Mon Sep 17 00:00:00 2001 From: woodser Date: Fri, 31 May 2019 15:00:52 -0400 Subject: [PATCH] implemented listener deconstructor removed getWallet2() method --- src/wallet/MoneroWallet.cpp | 11 ++++++----- src/wallet/MoneroWallet.h | 5 ----- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/wallet/MoneroWallet.cpp b/src/wallet/MoneroWallet.cpp index ce057ac..7a6ccd1 100644 --- a/src/wallet/MoneroWallet.cpp +++ b/src/wallet/MoneroWallet.cpp @@ -23,11 +23,15 @@ namespace monero { this->wallet = wallet; this->wallet2 = wallet2; this->listener = nullptr; + this->syncStartHeight = nullptr; + this->syncEndHeight = nullptr; this->syncListener = nullptr; } ~Wallet2Listener() { - + cout << "~Wallet2Listener()" << endl; + delete syncStartHeight; + delete syncEndHeight; } void setWalletListener(MoneroWalletListener* listener) { @@ -36,6 +40,7 @@ namespace monero { } void onSyncStart(uint64_t startHeight, MoneroSyncListener* syncListener) { + if (syncStartHeight != nullptr || syncEndHeight != nullptr) throw runtime_error("Sync start or end height should not already be allocated"); syncStartHeight = new uint64_t(startHeight); syncEndHeight = new uint64_t(wallet->getChainHeight() - 1); this->syncListener = syncListener; @@ -157,10 +162,6 @@ namespace monero { cout << "~MoneroWallet()" << endl; } - tools::wallet2* MoneroWallet::getWallet2() { - return wallet2.get(); - } - // TODO: switch this to setDaemonConnection(MoneroDaemonRpc& daemonConnection) void MoneroWallet::setDaemonConnection(const string& uri, const string& username, const string& password) { cout << "setDaemonConnection(" << uri << ", " << username << ", " << password << ")" << endl; diff --git a/src/wallet/MoneroWallet.h b/src/wallet/MoneroWallet.h index 4ec974f..36fde25 100644 --- a/src/wallet/MoneroWallet.h +++ b/src/wallet/MoneroWallet.h @@ -168,11 +168,6 @@ namespace monero { */ ~MoneroWallet(); - /** - * TODO: remove this. - */ - tools::wallet2* getWallet2(); - /** * Set the wallet's daemon connection. *