Merge pull request #5194

348320a3 wallet api/device: set estimated restore height if none is provided (selsta)
3c1c2499 wallet api: don't truncate address in subaddress_account (selsta)
This commit is contained in:
Riccardo Spagni 2019-02-27 14:36:23 +02:00
commit 685259082a
No known key found for this signature in database
GPG key ID: 55432DF31CCD4FCD
5 changed files with 16 additions and 1 deletions

View file

@ -62,7 +62,7 @@ void SubaddressAccountImpl::refresh()
{
m_rows.push_back(new SubaddressAccountRow(
i,
m_wallet->m_wallet->get_subaddress_as_str({i,0}).substr(0,6),
m_wallet->m_wallet->get_subaddress_as_str({i,0}),
m_wallet->m_wallet->get_subaddress_label({i,0}),
cryptonote::print_money(m_wallet->m_wallet->balance(i)),
cryptonote::print_money(m_wallet->m_wallet->unlocked_balance(i))

View file

@ -941,6 +941,12 @@ uint64_t WalletImpl::approximateBlockChainHeight() const
{
return m_wallet->get_approximate_blockchain_height();
}
uint64_t WalletImpl::estimateBlockChainHeight() const
{
return m_wallet->estimate_blockchain_height();
}
uint64_t WalletImpl::daemonBlockChainHeight() const
{
if(m_wallet->light_wallet()) {

View file

@ -109,6 +109,7 @@ public:
uint64_t unlockedBalance(uint32_t accountIndex = 0) const override;
uint64_t blockChainHeight() const override;
uint64_t approximateBlockChainHeight() const override;
uint64_t estimateBlockChainHeight() const override;
uint64_t daemonBlockChainHeight() const override;
uint64_t daemonBlockChainTargetHeight() const override;
bool synchronized() const override;

View file

@ -574,6 +574,12 @@ struct Wallet
*/
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
* @return 0 - in case error communicating with the daemon.

View file

@ -127,6 +127,8 @@ Wallet *WalletManagerImpl::createWalletFromDevice(const std::string &path,
WalletImpl * wallet = new WalletImpl(nettype, kdf_rounds);
if(restoreHeight > 0){
wallet->setRefreshFromBlockHeight(restoreHeight);
} else {
wallet->setRefreshFromBlockHeight(wallet->estimateBlockChainHeight());
}
auto lookahead = tools::parse_subaddress_lookahead(subaddressLookahead);
if (lookahead)