aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2015-01-04 19:11:44 +0100
committerWladimir J. van der Laan <laanwj@gmail.com>2015-01-07 13:11:58 +0100
commit867c600c292cf2a1c0f6f60742d8e23fb01179f6 (patch)
tree94040c08359d9e922557ac1b5784dace65aeda54
parent008138c04a3242b72dc5128ac3585b50ac44e84e (diff)
downloadbitcoin-867c600c292cf2a1c0f6f60742d8e23fb01179f6.tar.xz
Catch LevelDB errors during flush
Rebased-From: e41345790f1041f5c5e5605d73a0af174769aa55 Github-Pull: #5597
-rw-r--r--src/main.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/main.cpp b/src/main.cpp
index cf2d07604f..5e1be0d25c 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -1805,6 +1805,7 @@ enum FlushStateMode {
bool static FlushStateToDisk(CValidationState &state, FlushStateMode mode) {
LOCK(cs_main);
static int64_t nLastWrite = 0;
+ try {
if ((mode == FLUSH_STATE_ALWAYS) ||
((mode == FLUSH_STATE_PERIODIC || mode == FLUSH_STATE_IF_NEEDED) && pcoinsTip->GetCacheSize() > nCoinCacheSize) ||
(mode == FLUSH_STATE_PERIODIC && GetTimeMicros() > nLastWrite + DATABASE_WRITE_INTERVAL * 1000000)) {
@@ -1845,6 +1846,9 @@ bool static FlushStateToDisk(CValidationState &state, FlushStateMode mode) {
}
nLastWrite = GetTimeMicros();
}
+ } catch (const std::runtime_error& e) {
+ return state.Abort(std::string("System error while flushing: ") + e.what());
+ }
return true;
}