From fa91b2b2b3447a3645e7958c7dc4e1946a69cb9c Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Fri, 2 Apr 2021 20:49:01 +0200 Subject: move-only: Move AbortNode to shutdown Can be reviewed with the git option --color-moved=dimmed-zebra --- src/shutdown.cpp | 14 ++++++++++++++ src/shutdown.h | 5 +++++ src/validation.cpp | 13 ------------- 3 files changed, 19 insertions(+), 13 deletions(-) diff --git a/src/shutdown.cpp b/src/shutdown.cpp index 2fc195e2d1..35faf3c412 100644 --- a/src/shutdown.cpp +++ b/src/shutdown.cpp @@ -6,7 +6,9 @@ #include #include +#include #include +#include #include @@ -16,6 +18,18 @@ #include #endif +bool AbortNode(const std::string& strMessage, bilingual_str user_message) +{ + SetMiscWarning(Untranslated(strMessage)); + LogPrintf("*** %s\n", strMessage); + if (user_message.empty()) { + user_message = _("A fatal internal error occurred, see debug.log for details"); + } + AbortError(user_message); + StartShutdown(); + return false; +} + static std::atomic fRequestShutdown(false); #ifdef WIN32 /** On windows it is possible to simply use a condition variable. */ diff --git a/src/shutdown.h b/src/shutdown.h index b2fbdb8cfb..ff56c6bd87 100644 --- a/src/shutdown.h +++ b/src/shutdown.h @@ -6,6 +6,11 @@ #ifndef BITCOIN_SHUTDOWN_H #define BITCOIN_SHUTDOWN_H +#include // For bilingual_str + +/** Abort with a message */ +bool AbortNode(const std::string& strMessage, bilingual_str user_message = bilingual_str{}); + /** Initialize shutdown state. This must be called before using either StartShutdown(), * AbortShutdown() or WaitForShutdown(). Calling ShutdownRequested() is always safe. */ diff --git a/src/validation.cpp b/src/validation.cpp index 19363c0efb..6f184780c8 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -1636,19 +1636,6 @@ bool UndoReadFromDisk(CBlockUndo& blockundo, const CBlockIndex* pindex) return true; } -/** Abort with a message */ -static bool AbortNode(const std::string& strMessage, bilingual_str user_message = bilingual_str()) -{ - SetMiscWarning(Untranslated(strMessage)); - LogPrintf("*** %s\n", strMessage); - if (user_message.empty()) { - user_message = _("A fatal internal error occurred, see debug.log for details"); - } - AbortError(user_message); - StartShutdown(); - return false; -} - static bool AbortNode(BlockValidationState& state, const std::string& strMessage, const bilingual_str& userMessage = bilingual_str()) { AbortNode(strMessage, userMessage); -- cgit v1.2.3