From 9590591cebce3205e3e679f82e16869f1924806d Mon Sep 17 00:00:00 2001 From: woodser Date: Wed, 29 May 2019 13:07:12 -0400 Subject: [PATCH] added sync end height --- src/wallet/MoneroWallet.cpp | 6 +++++- src/wallet/MoneroWallet.h | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/wallet/MoneroWallet.cpp b/src/wallet/MoneroWallet.cpp index afba584..3bd4a60 100644 --- a/src/wallet/MoneroWallet.cpp +++ b/src/wallet/MoneroWallet.cpp @@ -195,8 +195,10 @@ MoneroSyncResult MoneroWallet::syncAux(uint64_t* startHeight, uint64_t* endHeigh // validate inputs if (endHeight != nullptr) throw runtime_error("Monero core wallet does not support syncing to an end height"); // TODO: custom exception type - // save sync start height and listener for sync notifications // TODO monero-core: support sync notifications + // save start height, end height, and listener for sync notifications + // TODO monero-core: support sync notifications syncStartHeight = new uint64_t(startHeight == nullptr ? max(MoneroWallet::getHeight(), MoneroWallet::getRestoreHeight()) : *startHeight); + syncEndHeight = new uint64_t(MoneroWallet::getChainHeight()); if (listener != nullptr) syncListener = unique_ptr(listener); // sync wallet @@ -206,6 +208,8 @@ MoneroSyncResult MoneroWallet::syncAux(uint64_t* startHeight, uint64_t* endHeigh // clear sync state variables delete syncStartHeight; syncStartHeight = nullptr; + delete syncEndHeight; + syncEndHeight = nullptr; syncListener.reset(); return result; diff --git a/src/wallet/MoneroWallet.h b/src/wallet/MoneroWallet.h index 5ed0bae..d509e3d 100644 --- a/src/wallet/MoneroWallet.h +++ b/src/wallet/MoneroWallet.h @@ -255,6 +255,7 @@ namespace monero { unique_ptr wallet2; // internal wallet implementation MoneroWalletListener* listener; // wallet's assigned listener uint64_t* syncStartHeight; // start height when sync is invoked for notifications + uint64_t* syncEndHeight; // current end height of sync unique_ptr syncListener; // listener when sync is invoked for notifications MoneroSyncResult syncAux(uint64_t* startHeight, uint64_t* endHeight, MoneroSyncListener* listener);