Skip to content

Commit e413457

Browse files
committed
Catch LevelDB errors during flush
1 parent 02bced1 commit e413457

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/main.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1807,6 +1807,7 @@ enum FlushStateMode {
18071807
bool static FlushStateToDisk(CValidationState &state, FlushStateMode mode) {
18081808
LOCK(cs_main);
18091809
static int64_t nLastWrite = 0;
1810+
try {
18101811
if ((mode == FLUSH_STATE_ALWAYS) ||
18111812
((mode == FLUSH_STATE_PERIODIC || mode == FLUSH_STATE_IF_NEEDED) && pcoinsTip->GetCacheSize() > nCoinCacheSize) ||
18121813
(mode == FLUSH_STATE_PERIODIC && GetTimeMicros() > nLastWrite + DATABASE_WRITE_INTERVAL * 1000000)) {
@@ -1846,6 +1847,9 @@ bool static FlushStateToDisk(CValidationState &state, FlushStateMode mode) {
18461847
}
18471848
nLastWrite = GetTimeMicros();
18481849
}
1850+
} catch (const std::runtime_error& e) {
1851+
return state.Abort(std::string("System error while flushing: ") + e.what());
1852+
}
18491853
return true;
18501854
}
18511855

0 commit comments

Comments
 (0)