parent
17b23ffe20
commit
6216b4b2dc
|
@ -730,6 +730,7 @@ void CWallet::WriteWitnessCache() {
|
||||||
LogPrintf("WriteWitnessCache(): Couldn't start atomic write\n");
|
LogPrintf("WriteWitnessCache(): Couldn't start atomic write\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
for (std::pair<const uint256, CWalletTx>& wtxItem : mapWallet) {
|
for (std::pair<const uint256, CWalletTx>& wtxItem : mapWallet) {
|
||||||
if (!walletdb.WriteTx(wtxItem.first, wtxItem.second)) {
|
if (!walletdb.WriteTx(wtxItem.first, wtxItem.second)) {
|
||||||
LogPrintf("WriteWitnessCache(): Failed to write CWalletTx, aborting atomic write\n");
|
LogPrintf("WriteWitnessCache(): Failed to write CWalletTx, aborting atomic write\n");
|
||||||
|
@ -742,6 +743,13 @@ void CWallet::WriteWitnessCache() {
|
||||||
walletdb.TxnAbort();
|
walletdb.TxnAbort();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
} catch (const std::exception &exc) {
|
||||||
|
// Unexpected failure
|
||||||
|
LogPrintf("WriteWitnessCache(): Unexpected error during atomic write:\n");
|
||||||
|
LogPrintf("%s\n", exc.what());
|
||||||
|
walletdb.TxnAbort();
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (!walletdb.TxnCommit()) {
|
if (!walletdb.TxnCommit()) {
|
||||||
// Couldn't commit all to db, but in-memory state is fine
|
// Couldn't commit all to db, but in-memory state is fine
|
||||||
LogPrintf("WriteWitnessCache(): Couldn't commit atomic write\n");
|
LogPrintf("WriteWitnessCache(): Couldn't commit atomic write\n");
|
||||||
|
|
Loading…
Reference in New Issue