mirror of
https://github.com/dashpay/dash.git
synced 2024-12-27 21:12:48 +01:00
Catch LevelDB errors during flush
This commit is contained in:
parent
02bced1661
commit
e41345790f
@ -1807,6 +1807,7 @@ enum FlushStateMode {
|
|||||||
bool static FlushStateToDisk(CValidationState &state, FlushStateMode mode) {
|
bool static FlushStateToDisk(CValidationState &state, FlushStateMode mode) {
|
||||||
LOCK(cs_main);
|
LOCK(cs_main);
|
||||||
static int64_t nLastWrite = 0;
|
static int64_t nLastWrite = 0;
|
||||||
|
try {
|
||||||
if ((mode == FLUSH_STATE_ALWAYS) ||
|
if ((mode == FLUSH_STATE_ALWAYS) ||
|
||||||
((mode == FLUSH_STATE_PERIODIC || mode == FLUSH_STATE_IF_NEEDED) && pcoinsTip->GetCacheSize() > nCoinCacheSize) ||
|
((mode == FLUSH_STATE_PERIODIC || mode == FLUSH_STATE_IF_NEEDED) && pcoinsTip->GetCacheSize() > nCoinCacheSize) ||
|
||||||
(mode == FLUSH_STATE_PERIODIC && GetTimeMicros() > nLastWrite + DATABASE_WRITE_INTERVAL * 1000000)) {
|
(mode == FLUSH_STATE_PERIODIC && GetTimeMicros() > nLastWrite + DATABASE_WRITE_INTERVAL * 1000000)) {
|
||||||
@ -1846,6 +1847,9 @@ bool static FlushStateToDisk(CValidationState &state, FlushStateMode mode) {
|
|||||||
}
|
}
|
||||||
nLastWrite = GetTimeMicros();
|
nLastWrite = GetTimeMicros();
|
||||||
}
|
}
|
||||||
|
} catch (const std::runtime_error& e) {
|
||||||
|
return state.Abort(std::string("System error while flushing: ") + e.what());
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user