mirror of
https://github.com/monero-project/monero.git
synced 2024-12-14 04:16:32 +02:00
wallet api/device: set estimated restore height if none is provided
This commit is contained in:
parent
e344d93ce7
commit
13785ec96b
@ -942,6 +942,12 @@ uint64_t WalletImpl::approximateBlockChainHeight() const
|
|||||||
{
|
{
|
||||||
return m_wallet->get_approximate_blockchain_height();
|
return m_wallet->get_approximate_blockchain_height();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint64_t WalletImpl::estimateBlockChainHeight() const
|
||||||
|
{
|
||||||
|
return m_wallet->estimate_blockchain_height();
|
||||||
|
}
|
||||||
|
|
||||||
uint64_t WalletImpl::daemonBlockChainHeight() const
|
uint64_t WalletImpl::daemonBlockChainHeight() const
|
||||||
{
|
{
|
||||||
if(m_wallet->light_wallet()) {
|
if(m_wallet->light_wallet()) {
|
||||||
|
@ -109,6 +109,7 @@ public:
|
|||||||
uint64_t unlockedBalance(uint32_t accountIndex = 0) const override;
|
uint64_t unlockedBalance(uint32_t accountIndex = 0) const override;
|
||||||
uint64_t blockChainHeight() const override;
|
uint64_t blockChainHeight() const override;
|
||||||
uint64_t approximateBlockChainHeight() const override;
|
uint64_t approximateBlockChainHeight() const override;
|
||||||
|
uint64_t estimateBlockChainHeight() const override;
|
||||||
uint64_t daemonBlockChainHeight() const override;
|
uint64_t daemonBlockChainHeight() const override;
|
||||||
uint64_t daemonBlockChainTargetHeight() const override;
|
uint64_t daemonBlockChainTargetHeight() const override;
|
||||||
bool synchronized() const override;
|
bool synchronized() const override;
|
||||||
|
@ -574,6 +574,12 @@ struct Wallet
|
|||||||
*/
|
*/
|
||||||
virtual uint64_t approximateBlockChainHeight() const = 0;
|
virtual uint64_t approximateBlockChainHeight() const = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief estimateBlockChainHeight - returns estimate blockchain height. More accurate than approximateBlockChainHeight,
|
||||||
|
* uses daemon height and falls back to calculation from date/time
|
||||||
|
* @return
|
||||||
|
**/
|
||||||
|
virtual uint64_t estimateBlockChainHeight() const = 0;
|
||||||
/**
|
/**
|
||||||
* @brief daemonBlockChainHeight - returns daemon blockchain height
|
* @brief daemonBlockChainHeight - returns daemon blockchain height
|
||||||
* @return 0 - in case error communicating with the daemon.
|
* @return 0 - in case error communicating with the daemon.
|
||||||
|
@ -127,6 +127,8 @@ Wallet *WalletManagerImpl::createWalletFromDevice(const std::string &path,
|
|||||||
WalletImpl * wallet = new WalletImpl(nettype, kdf_rounds);
|
WalletImpl * wallet = new WalletImpl(nettype, kdf_rounds);
|
||||||
if(restoreHeight > 0){
|
if(restoreHeight > 0){
|
||||||
wallet->setRefreshFromBlockHeight(restoreHeight);
|
wallet->setRefreshFromBlockHeight(restoreHeight);
|
||||||
|
} else {
|
||||||
|
wallet->setRefreshFromBlockHeight(wallet->estimateBlockChainHeight());
|
||||||
}
|
}
|
||||||
auto lookahead = tools::parse_subaddress_lookahead(subaddressLookahead);
|
auto lookahead = tools::parse_subaddress_lookahead(subaddressLookahead);
|
||||||
if (lookahead)
|
if (lookahead)
|
||||||
|
Loading…
Reference in New Issue
Block a user