diff --git a/src/noui.cpp b/src/noui.cpp --- a/src/noui.cpp +++ b/src/noui.cpp @@ -21,11 +21,8 @@ const std::string &caption, unsigned int style) { bool fSecure = style & CClientUIInterface::SECURE; style &= ~CClientUIInterface::SECURE; - bool prefix = !(style & CClientUIInterface::MSG_NOPREFIX); - style &= ~CClientUIInterface::MSG_NOPREFIX; std::string strCaption; - if (prefix) { switch (style) { case CClientUIInterface::MSG_ERROR: strCaption = "Error: "; @@ -40,7 +37,6 @@ // Use supplied caption (can be empty) strCaption = caption + ": "; } - } if (!fSecure) { LogPrintf("%s%s\n", strCaption, message.original); diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -1207,9 +1207,6 @@ int nMBoxIcon = QMessageBox::Information; int nNotifyIcon = Notificator::Information; - bool prefix = !(style & CClientUIInterface::MSG_NOPREFIX); - style &= ~CClientUIInterface::MSG_NOPREFIX; - QString msgType; if (!title.isEmpty()) { msgType = title; @@ -1217,15 +1214,11 @@ switch (style) { case CClientUIInterface::MSG_ERROR: msgType = tr("Error"); - if (prefix) { - message = tr("Error: %1").arg(message); - } + message = tr("Error: %1").arg(message); break; case CClientUIInterface::MSG_WARNING: msgType = tr("Warning"); - if (prefix) { - message = tr("Warning: %1").arg(message); - } + message = tr("Warning: %1").arg(message); break; case CClientUIInterface::MSG_INFORMATION: msgType = tr("Information"); diff --git a/src/qt/walletcontroller.cpp b/src/qt/walletcontroller.cpp --- a/src/qt/walletcontroller.cpp +++ b/src/qt/walletcontroller.cpp @@ -243,7 +243,7 @@ void CreateWalletActivity::finish() { m_progress_dialog->hide(); - if (!m_error_message.original.empty()) { + if (!m_error_message.empty()) { QMessageBox::critical( m_parent_widget, tr("Create wallet failed"), QString::fromStdString(m_error_message.translated)); @@ -287,7 +287,7 @@ void OpenWalletActivity::finish() { m_progress_dialog->hide(); - if (!m_error_message.original.empty()) { + if (!m_error_message.empty()) { QMessageBox::critical( m_parent_widget, tr("Open wallet failed"), QString::fromStdString(m_error_message.translated)); diff --git a/src/ui_interface.h b/src/ui_interface.h --- a/src/ui_interface.h +++ b/src/ui_interface.h @@ -67,9 +67,6 @@ */ MODAL = 0x10000000U, - /** Do not prepend error/warning prefix */ - MSG_NOPREFIX = 0x20000000U, - /** Do not print contents of message to debug log */ SECURE = 0x40000000U, diff --git a/src/validation.cpp b/src/validation.cpp --- a/src/validation.cpp +++ b/src/validation.cpp @@ -1288,32 +1288,26 @@ return true; } +constexpr auto AbortError = InitError; + /** Abort with a message */ static bool AbortNode(const std::string &strMessage, - const std::string &userMessage = "", - unsigned int prefix = 0) { + bilingual_str user_message = bilingual_str()) { SetMiscWarning(strMessage); LogPrintf("*** %s\n", strMessage); - if (!userMessage.empty()) { - uiInterface.ThreadSafeMessageBox(Untranslated(userMessage), "", - CClientUIInterface::MSG_ERROR | - prefix); - } else { - uiInterface.ThreadSafeMessageBox( - _("Error: A fatal internal error occurred, see debug.log for " - "details"), - "", - CClientUIInterface::MSG_ERROR | CClientUIInterface::MSG_NOPREFIX); + 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 std::string &userMessage = "", - unsigned int prefix = 0) { - AbortNode(strMessage, userMessage, prefix); + const bilingual_str &userMessage = bilingual_str()) { + AbortNode(strMessage, userMessage); return state.Error(strMessage); } @@ -2118,10 +2112,8 @@ if (fDoFullFlush || fPeriodicWrite) { // Depend on nMinDiskSpace to ensure we can write block index if (!CheckDiskSpace(GetBlocksDir())) { - return AbortNode( - state, "Disk space is too low!", - _("Error: Disk space is too low!").translated, - CClientUIInterface::MSG_NOPREFIX); + return AbortNode(state, "Disk space is too low!", + _("Disk space is too low!")); } // First make sure all block and undo data is flushed to disk. @@ -2169,10 +2161,8 @@ // factor of 2. if (!CheckDiskSpace(GetDataDir(), 48 * 2 * 2 * CoinsTip().GetCacheSize())) { - return AbortNode( - state, "Disk space is too low!", - _("Error: Disk space is too low!").translated, - CClientUIInterface::MSG_NOPREFIX); + return AbortNode(state, "Disk space is too low!", + _("Disk space is too low!")); } // Flush the chainstate (which may refer to block index @@ -3651,8 +3641,7 @@ BlockFileSeq().Allocate(pos, nAddSize, out_of_space); if (out_of_space) { return AbortNode("Disk space is too low!", - _("Error: Disk space is too low!").translated, - CClientUIInterface::MSG_NOPREFIX); + _("Disk space is too low!")); } if (bytes_allocated != 0 && fPruneMode) { fCheckForPruning = true; @@ -3678,8 +3667,7 @@ UndoFileSeq().Allocate(pos, nAddSize, out_of_space); if (out_of_space) { return AbortNode(state, "Disk space is too low!", - _("Error: Disk space is too low!").translated, - CClientUIInterface::MSG_NOPREFIX); + _("Disk space is too low!")); } if (bytes_allocated != 0 && fPruneMode) { fCheckForPruning = true;