Skip to content

Commit fa91b2b

Browse files
author
MarcoFalke
committed
move-only: Move AbortNode to shutdown
Can be reviewed with the git option --color-moved=dimmed-zebra
1 parent fa413f0 commit fa91b2b

File tree

3 files changed

+19
-13
lines changed

3 files changed

+19
-13
lines changed

src/shutdown.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
#include <shutdown.h>
77

88
#include <logging.h>
9+
#include <node/ui_interface.h>
910
#include <util/tokenpipe.h>
11+
#include <warnings.h>
1012

1113
#include <config/bitcoin-config.h>
1214

@@ -16,6 +18,18 @@
1618
#include <condition_variable>
1719
#endif
1820

21+
bool AbortNode(const std::string& strMessage, bilingual_str user_message)
22+
{
23+
SetMiscWarning(Untranslated(strMessage));
24+
LogPrintf("*** %s\n", strMessage);
25+
if (user_message.empty()) {
26+
user_message = _("A fatal internal error occurred, see debug.log for details");
27+
}
28+
AbortError(user_message);
29+
StartShutdown();
30+
return false;
31+
}
32+
1933
static std::atomic<bool> fRequestShutdown(false);
2034
#ifdef WIN32
2135
/** On windows it is possible to simply use a condition variable. */

src/shutdown.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@
66
#ifndef BITCOIN_SHUTDOWN_H
77
#define BITCOIN_SHUTDOWN_H
88

9+
#include <util/translation.h> // For bilingual_str
10+
11+
/** Abort with a message */
12+
bool AbortNode(const std::string& strMessage, bilingual_str user_message = bilingual_str{});
13+
914
/** Initialize shutdown state. This must be called before using either StartShutdown(),
1015
* AbortShutdown() or WaitForShutdown(). Calling ShutdownRequested() is always safe.
1116
*/

src/validation.cpp

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1636,19 +1636,6 @@ bool UndoReadFromDisk(CBlockUndo& blockundo, const CBlockIndex* pindex)
16361636
return true;
16371637
}
16381638

1639-
/** Abort with a message */
1640-
static bool AbortNode(const std::string& strMessage, bilingual_str user_message = bilingual_str())
1641-
{
1642-
SetMiscWarning(Untranslated(strMessage));
1643-
LogPrintf("*** %s\n", strMessage);
1644-
if (user_message.empty()) {
1645-
user_message = _("A fatal internal error occurred, see debug.log for details");
1646-
}
1647-
AbortError(user_message);
1648-
StartShutdown();
1649-
return false;
1650-
}
1651-
16521639
static bool AbortNode(BlockValidationState& state, const std::string& strMessage, const bilingual_str& userMessage = bilingual_str())
16531640
{
16541641
AbortNode(strMessage, userMessage);

0 commit comments

Comments
 (0)