mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-21 14:34:49 +01:00
move-only: Move AbortNode to shutdown
Can be reviewed with the git option --color-moved=dimmed-zebra
This commit is contained in:
parent
fa413f07a1
commit
fa91b2b2b3
3 changed files with 19 additions and 13 deletions
|
@ -6,7 +6,9 @@
|
|||
#include <shutdown.h>
|
||||
|
||||
#include <logging.h>
|
||||
#include <node/ui_interface.h>
|
||||
#include <util/tokenpipe.h>
|
||||
#include <warnings.h>
|
||||
|
||||
#include <config/bitcoin-config.h>
|
||||
|
||||
|
@ -16,6 +18,18 @@
|
|||
#include <condition_variable>
|
||||
#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<bool> fRequestShutdown(false);
|
||||
#ifdef WIN32
|
||||
/** On windows it is possible to simply use a condition variable. */
|
||||
|
|
|
@ -6,6 +6,11 @@
|
|||
#ifndef BITCOIN_SHUTDOWN_H
|
||||
#define BITCOIN_SHUTDOWN_H
|
||||
|
||||
#include <util/translation.h> // 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.
|
||||
*/
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Add table
Reference in a new issue