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.
continue;
                    }
                    int64_t nSmartTime;
                    nSmartTime = pwtx->nTimeSmart;
                    if (!nSmartTime) {
                        nSmartTime = pwtx->nTimeReceived;
                    }
                    if (nSmartTime <= latestTolerated) {
                        latestEntry = nSmartTime;
                        if (nSmartTime > latestNow) {
                            latestNow = nSmartTime;
                        }
                        break;
                    }
                }
                nTimeSmart = stdmax(latestEntry, stdmin(blocktime, latestNow));
            }
        } else {
            WalletLogPrintf("%s found %s in block %s not in index\n", __func__, wtx.GetHash().ToString(), block_hash->ToString());
        }
    }
    return nTimeSmart;
}
bool CWalletSetAddressUsed(WalletBatch& batch, const CTxDestination& dest, bool used)
{
    const stdstring key{"used"};
    if (stdget_if<CNoDestination>(&dest))
        return false;
    if (!used) {
        if (auto* data = utilFindKey(m_address_book, dest)) data->destdata.erase(key);