This is to track the regression introduced in master, which needs fixing for 0.14. See #9240, #9371, etc.
if (fFileBacked)
        {
            if (!pwalletdbEncryption->TxnCommit()) {
                delete pwalletdbEncryption;
                
                
                assert(false);
            }
            delete pwalletdbEncryption;
            pwalletdbEncryption = NULL;
        }
        Lock();
        Unlock(strWalletPassphrase);
        
        if (IsHDEnabled()) {
            CKey key;
            CPubKey masterPubKey = GenerateNewHDMasterKey();
            if (!SetHDMasterKey(masterPubKey))
                return false;
        }
        NewKeyPool();
        Lock();
        
        
        CDB::Rewrite(strWalletFile);
    }
    NotifyStatusChanged(this);
    return true;
}
DBErrors CWallet::ReorderTransactions()