Right now to recover from a backup with an encrypted HD wallet the user must do something like unlock the wallet with a really long time out and manually trigger a rescan,  otherwise they risk missing some keys when auto-topup cannot run.
oldest_key = stdmin(oldest_key, spk_man_pair.second->GetOldestKeyPoolTime());
    }
    return oldest_key;
}
void CWalletMarkDestinationsDirty(const stdset<CTxDestination>& destinations) {
    for (auto& entry  mapWallet) {
        CWalletTx& wtx = entry.second;
        if (wtx.m_is_cache_empty) continue;
        for (unsigned int i = 0; i < wtx.tx->vout.size(); i++) {
            CTxDestination dst;
            if (ExtractDestination(wtx.tx->vout[i].scriptPubKey, dst) && destinations.count(dst)) {
                wtx.MarkDirty();
                break;
            }
        }
    }
}
void CWalletForEachAddrBookEntry(const ListAddrBookFunc& func) const
{
    AssertLockHeld(cs_);
    for (const stdpair<const CTxDestination, CAddressBookData>& item  m_address_book) {
        const auto& entry = item.second;
        func(item.first, entry.GetLabel(), entry.purpose, entry.IsChange());
    }
}
stdvector<CTxDestination> CWalletListAddrBookAddresses(const stdoptional<AddrBookFilter>& _filter) const
{
    AssertLockHeld(cs_);
    stdvector<CTxDestination> result;
    AddrBookFilter filter = _filter ? *_filter  AddrBookFilter();