aboutsummaryrefslogtreecommitdiff
path: root/src/coins.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/coins.cpp')
-rw-r--r--src/coins.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/coins.cpp b/src/coins.cpp
index 3ef9e0463c..6b85edd01a 100644
--- a/src/coins.cpp
+++ b/src/coins.cpp
@@ -5,6 +5,7 @@
#include <coins.h>
#include <consensus/consensus.h>
+#include <logging.h>
#include <random.h>
#include <version.h>
@@ -258,3 +259,19 @@ const Coin& AccessByTxid(const CCoinsViewCache& view, const uint256& txid)
}
return coinEmpty;
}
+
+bool CCoinsViewErrorCatcher::GetCoin(const COutPoint &outpoint, Coin &coin) const {
+ try {
+ return CCoinsViewBacked::GetCoin(outpoint, coin);
+ } catch(const std::runtime_error& e) {
+ for (auto f : m_err_callbacks) {
+ f();
+ }
+ LogPrintf("Error reading from database: %s\n", e.what());
+ // Starting the shutdown sequence and returning false to the caller would be
+ // interpreted as 'entry not found' (as opposed to unable to read data), and
+ // could lead to invalid interpretation. Just exit immediately, as we can't
+ // continue anyway, and all writes should be atomic.
+ std::abort();
+ }
+}