added sync end height

This commit is contained in:
woodser
2019-05-29 13:07:12 -04:00
parent e5d7696180
commit 9590591ceb
2 changed files with 6 additions and 1 deletions
+5 -1
View File
@@ -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<MoneroSyncListener>(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;
+1
View File
@@ -255,6 +255,7 @@ namespace monero {
unique_ptr<tools::wallet2> 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<MoneroSyncListener> syncListener; // listener when sync is invoked for notifications
MoneroSyncResult syncAux(uint64_t* startHeight, uint64_t* endHeight, MoneroSyncListener* listener);