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.
}
void CWalletUnsetBlankWalletFlag(WalletBatch& batch)
{
    UnsetWalletFlagWithDB(batch, WALLET_FLAG_BLANK_WALLET);
}
bool CWalletIsWalletFlagSet(uint64_t flag) const
{
    return (m__flags & flag);
}
bool CWalletLoadWalletFlags(uint64_t flags)
{
    LOCK(cs_);
    if (((flags & KNOWN_WALLET_FLAGS) >> 32) ^ (flags >> 32)) {
        // c
        return false;
    }
    m__flags = flags;
    return true;
}
void CWalletInitWalletFlags(uint64_t flags)
{
    LOCK(cs_);
    // W
    assert(((flags & KNOWN_WALLET_FLAGS) >> 32) == (flags >> 32));
    // T
    assert(m__flags == 0);
    if (!WalletBatch(GetDatabase()).WriteWalletFlags(flags)) {
        throw stdruntime_error(stdstring(__func__) + " writing  flags failed");
    }
    if (!LoadWalletFlags(flags)) assert(