diff --git a/src/walletdb.cpp b/src/walletdb.cpp index 2fa6071658..48045b98c8 100644 --- a/src/walletdb.cpp +++ b/src/walletdb.cpp @@ -281,8 +281,12 @@ CWalletDB::ReorderTransactions(CWallet* pwallet) nOrderPos = nOrderPosNext++; nOrderPosOffsets.push_back(nOrderPos); - if (pacentry) - // Have to write accounting regardless, since we don't keep it in memory + if (pwtx) + { + if (!WriteTx(pwtx->GetHash(), *pwtx)) + return DB_LOAD_FAIL; + } + else if (!WriteAccountingEntry(pacentry->nEntryNo, *pacentry)) return DB_LOAD_FAIL; } @@ -311,6 +315,7 @@ CWalletDB::ReorderTransactions(CWallet* pwallet) return DB_LOAD_FAIL; } } + WriteOrderPosNext(nOrderPosNext); return DB_LOAD_OK; }