libwallet_api: Added option to restore from specific height

This commit is contained in:
Jacob Brydolf 2016-10-08 00:57:09 +02:00
parent 9798bde11e
commit 36a89ab435
No known key found for this signature in database
GPG key ID: DE46246550D2F3C5
5 changed files with 20 additions and 3 deletions

View file

@ -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

View file

@ -82,6 +82,7 @@ public:
void refreshAsync();
void setAutoRefreshInterval(int millis);
int autoRefreshInterval() const;
void setRefreshFromBlockHeight(uint64_t refresh_from_block_height);

View file

@ -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;
}

View file

@ -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);