Line data Source code
1 : // Copyright (c) 2023 The Bitcoin Core developers 2 : // Distributed under the MIT software license, see the accompanying 3 : // file COPYING or http://www.opensource.org/licenses/mit-license.php. 4 : 5 : #include <node/abort.h> 6 : 7 : #include <logging.h> 8 : #include <node/interface_ui.h> 9 : #include <shutdown.h> 10 : #include <util/translation.h> 11 : #include <warnings.h> 12 : 13 : #include <atomic> 14 : #include <cstdlib> 15 : #include <string> 16 : 17 : namespace node { 18 : 19 0 : void AbortNode(std::atomic<int>& exit_status, const std::string& debug_message, const bilingual_str& user_message, bool shutdown) 20 : { 21 0 : SetMiscWarning(Untranslated(debug_message)); 22 0 : LogPrintf("*** %s\n", debug_message); 23 0 : InitError(user_message.empty() ? _("A fatal internal error occurred, see debug.log for details") : user_message); 24 0 : exit_status.store(EXIT_FAILURE); 25 0 : if (shutdown) StartShutdown(); 26 0 : } 27 : } // namespace node