diff options
author | Jacob Brydolf <jacob@brydolf.net> | 2016-10-08 00:57:09 +0200 |
---|---|---|
committer | Jacob Brydolf <jacob@brydolf.net> | 2016-10-08 00:57:09 +0200 |
commit | 36a89ab435fc5a2bc7860c6dc2448404ea20dc8e (patch) | |
tree | 0b9569cf0b6e68fc754876cc07129c23bf869252 /src/wallet/api | |
parent | Merge pull request #1182 (diff) | |
download | monero-36a89ab435fc5a2bc7860c6dc2448404ea20dc8e.tar.xz |
libwallet_api: Added option to restore from specific height
Diffstat (limited to 'src/wallet/api')
-rw-r--r-- | src/wallet/api/wallet.cpp | 4 | ||||
-rw-r--r-- | src/wallet/api/wallet.h | 1 | ||||
-rw-r--r-- | src/wallet/api/wallet_manager.cpp | 5 | ||||
-rw-r--r-- | src/wallet/api/wallet_manager.h | 2 |
4 files changed, 10 insertions, 2 deletions
diff --git a/src/wallet/api/wallet.cpp b/src/wallet/api/wallet.cpp index 4d35bc404..447d46651 100644 --- a/src/wallet/api/wallet.cpp +++ b/src/wallet/api/wallet.cpp @@ -404,6 +404,10 @@ void WalletImpl::initAsync(const string &daemon_address, uint64_t upper_transact startRefresh(); } +void WalletImpl::setRefreshFromBlockHeight(uint64_t refresh_from_block_height) +{ + m_wallet->set_refresh_from_block_height(refresh_from_block_height); +} uint64_t WalletImpl::balance() const diff --git a/src/wallet/api/wallet.h b/src/wallet/api/wallet.h index c399e3ab6..7afcfbcd2 100644 --- a/src/wallet/api/wallet.h +++ b/src/wallet/api/wallet.h @@ -82,6 +82,7 @@ public: void refreshAsync(); void setAutoRefreshInterval(int millis); int autoRefreshInterval() const; + void setRefreshFromBlockHeight(uint64_t refresh_from_block_height); diff --git a/src/wallet/api/wallet_manager.cpp b/src/wallet/api/wallet_manager.cpp index ca83806ff..aa99476ee 100644 --- a/src/wallet/api/wallet_manager.cpp +++ b/src/wallet/api/wallet_manager.cpp @@ -57,9 +57,12 @@ Wallet *WalletManagerImpl::openWallet(const std::string &path, const std::string return wallet; } -Wallet *WalletManagerImpl::recoveryWallet(const std::string &path, const std::string &memo, bool testnet) +Wallet *WalletManagerImpl::recoveryWallet(const std::string &path, const std::string &memo, bool testnet, uint64_t restoreHeight) { WalletImpl * wallet = new WalletImpl(testnet); + if(restoreHeight > 0){ + wallet->setRefreshFromBlockHeight(restoreHeight); + } wallet->recover(path, memo); return wallet; } diff --git a/src/wallet/api/wallet_manager.h b/src/wallet/api/wallet_manager.h index 7585c1af7..2e932a2a1 100644 --- a/src/wallet/api/wallet_manager.h +++ b/src/wallet/api/wallet_manager.h @@ -40,7 +40,7 @@ public: Wallet * createWallet(const std::string &path, const std::string &password, const std::string &language, bool testnet); Wallet * openWallet(const std::string &path, const std::string &password, bool testnet); - virtual Wallet * recoveryWallet(const std::string &path, const std::string &memo, bool testnet); + virtual Wallet * recoveryWallet(const std::string &path, const std::string &memo, bool testnet, uint64_t restoreHeight); virtual bool closeWallet(Wallet *wallet); bool walletExists(const std::string &path); std::vector<std::string> findWallets(const std::string &path); |