refactor: [gui] Document that the title is always empty for node message
What changed, and why it matters
This is a minor code cleanup in the Bitcoin Core graphical user interface. It removes an unused function parameter and adds a comment explaining that message titles are empty for messages coming from the network node. The commit message explicitly states it does not change any behavior, and the diff confirms this: the same empty title is still passed, just through a local variable instead of a function argument.
No security action needed. This is a non-functional refactor and can be treated as routine code maintenance.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The change refactors ThreadSafeMessageBox in src/qt/bitcoingui.cpp to drop the caption parameter, which was always passed as an empty string by both call sites (m_node.handleMessageBox and m_node.handleQuestion). It replaces QString::fromStdString(caption) with a local const QString title{} and adds a comment documenting that node messages carry no title and that the fallback title is determined by style. No functional behavior is altered.
Changed components
src/qt/bitcoingui.cppInspect captured patch +7 / −4
diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp
index 3c3f84c7..315b0088 100644
--- a/src/qt/bitcoingui.cpp
+++ b/src/qt/bitcoingui.cpp
@@ -1587,7 +1587,7 @@ void BitcoinGUI::showModalOverlay()
modalOverlay->toggleVisibility();
}
-static bool ThreadSafeMessageBox(BitcoinGUI* gui, const bilingual_str& message, const std::string& caption, unsigned int style)
+static bool ThreadSafeMessageBox(BitcoinGUI* gui, const bilingual_str& message, unsigned int style)
{
bool modal = (style & CClientUIInterface::MODAL);
// The SECURE flag has no effect in the Qt GUI.
@@ -1599,11 +1599,14 @@ static bool ThreadSafeMessageBox(BitcoinGUI* gui, const bilingual_str& message,
if (message.original != message.translated) {
detailed_message = BitcoinGUI::tr("Original message:") + "\n" + QString::fromStdString(message.original);
}
+ // The title is empty for node messages. The fallback title is usually set
+ // by `style`.
+ const QString title{};
// In case of modal message, use blocking connection to wait for user to click a button
bool invoked = QMetaObject::invokeMethod(gui, "message",
modal ? GUIUtil::blockingGUIThreadConnection() : Qt::QueuedConnection,
- Q_ARG(QString, QString::fromStdString(caption)),
+ Q_ARG(QString, title),
Q_ARG(QString, QString::fromStdString(message.translated)),
Q_ARG(unsigned int, style),
Q_ARG(bool*, &ret),
@@ -1616,10 +1619,10 @@ void BitcoinGUI::subscribeToCoreSignals()
{
// Connect signals to client
m_handler_message_box = m_node.handleMessageBox([this](const bilingual_str& message, unsigned int style) {
- return ThreadSafeMessageBox(this, message, /*caption=*/"", style);
+ return ThreadSafeMessageBox(this, message, style);
});
m_handler_question = m_node.handleQuestion([this](const bilingual_str& message, const std::string& /*non_interactive_message*/, unsigned int style) {
- return ThreadSafeMessageBox(this, message, /*caption=*/"", style);
+ return ThreadSafeMessageBox(this, message, style);
});
}
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.