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.
}
    NotifyStatusChanged(this);
    return true;
}
DBErrors CWalletReorderTransactions()
{
    LOCK(cs_);
    WalletBatch batch(GetDatabase());
    // O
    // P
    // F
    typedef stdmultimap<int64_t, CWalletTx*> TxItems;
    TxItems txByTime;
    for (auto& entry  mapWallet)
    {
        CWalletTx* wtx = &entry.second;
        txByTime.insert(stdmake_pair(wtx->nTimeReceived, wtx));
    }
    nOrderPosNext = 0;
    stdvector<int64_t> nOrderPosOffsets;
    for (TxItemsiterator it = txByTime.begin(); it != txByTime.end(); ++it)
    {
        CWalletTx *const pwtx = (*it).second;
        int64_t& nOrderPos = pwtx->nOrderPos;
        if (nOrderPos == -1)
        {
            nOrderPos = nOrderPosNext++;
            nOrderPosOffsets.push_back(nOrderPos);
            if (!batch.WriteTx(*pwtx))
                return DBErrorsLOAD_FAIL;