mirror of
https://github.com/wownero/wownero-cpp.git
synced 2026-10-20 08:38:41 +02:00
added sync end height
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user