init: add exe name to bitcoind, bitcoin-node -version output to be able to distinguish these in tests
What changed, and why it matters
This commit changes the -version output of Bitcoin's command-line and GUI programs so the name of the executable (for example 'bitcoind' or 'bitcoin-node') is printed alongside the version string. It is a testing/debugging convenience change and does not alter how wallets, network messages, or consensus rules are handled.
No security action needed; this is a benign output-formatting change.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch adds an exeName() virtual method to interfaces::Init and implements it in each init class (bitcoind, bitcoin-node, bitcoin-qt, bitcoin-gui). ProcessInitCommands in src/bitcoind.cpp now appends init.exeName() to the version banner when -version is requested. No security-sensitive logic, input parsing, privilege boundaries, or network behavior is modified.
Changed components
src/bitcoind.cppsrc/init/bitcoind.cppsrc/init/bitcoin-node.cppsrc/init/bitcoin-gui.cppsrc/init/bitcoin-qt.cppsrc/interfaces/init.hInspect captured patch +17 / −3
diff --git a/src/bitcoind.cpp b/src/bitcoind.cpp
index ceb3c994..a4373daf 100644
--- a/src/bitcoind.cpp
+++ b/src/bitcoind.cpp
@@ -132,11 +132,16 @@ static bool ParseArgs(NodeContext& node, int argc, char* argv[])
return true;
}
-static bool ProcessInitCommands(ArgsManager& args)
+static bool ProcessInitCommands(interfaces::Init& init, ArgsManager& args)
{
// Process help and version before taking care about datadir
if (HelpRequested(args) || args.GetBoolArg("-version", false)) {
- std::string strUsage = CLIENT_NAME " daemon version " + FormatFullVersion() + "\n";
+ std::string strUsage = CLIENT_NAME " daemon version " + FormatFullVersion();
+ if (const char* exe_name{init.exeName()}) {
+ strUsage += " ";
+ strUsage += exe_name;
+ }
+ strUsage += "\n";
if (args.GetBoolArg("-version", false)) {
strUsage += FormatParagraph(LicenseInfo());
@@ -277,7 +282,7 @@ MAIN_FUNCTION
ArgsManager& args = *Assert(node.args);
if (!ParseArgs(node, argc, argv)) return EXIT_FAILURE;
// Process early info return commands such as -help or -version
- if (ProcessInitCommands(args)) return EXIT_SUCCESS;
+ if (ProcessInitCommands(*init, args)) return EXIT_SUCCESS;
// Start application
if (!AppInit(node) || !Assert(node.shutdown_signal)->wait()) {
diff --git a/src/init/bitcoin-gui.cpp b/src/init/bitcoin-gui.cpp
index eae30bc9..aca3fbe1 100644
--- a/src/init/bitcoin-gui.cpp
+++ b/src/init/bitcoin-gui.cpp
@@ -39,6 +39,7 @@ public:
// bitcoin-node accepts the option, and bitcoin-gui accepts all bitcoin-node
// options and will start the node with those options.
bool canListenIpc() override { return true; }
+ const char* exeName() override { return EXE_NAME; }
node::NodeContext m_node;
std::unique_ptr<interfaces::Ipc> m_ipc;
};
diff --git a/src/init/bitcoin-node.cpp b/src/init/bitcoin-node.cpp
index 3f8c50b8..e5f1411f 100644
--- a/src/init/bitcoin-node.cpp
+++ b/src/init/bitcoin-node.cpp
@@ -38,6 +38,7 @@ public:
std::unique_ptr<interfaces::Echo> makeEcho() override { return interfaces::MakeEcho(); }
interfaces::Ipc* ipc() override { return m_ipc.get(); }
bool canListenIpc() override { return true; }
+ const char* exeName() override { return EXE_NAME; }
node::NodeContext& m_node;
std::unique_ptr<interfaces::Ipc> m_ipc;
};
diff --git a/src/init/bitcoin-qt.cpp b/src/init/bitcoin-qt.cpp
index 5209c729..05f3bc32 100644
--- a/src/init/bitcoin-qt.cpp
+++ b/src/init/bitcoin-qt.cpp
@@ -16,6 +16,8 @@
namespace init {
namespace {
+const char* EXE_NAME = "bitcoin-qt";
+
class BitcoinQtInit : public interfaces::Init
{
public:
@@ -32,6 +34,7 @@ public:
return MakeWalletLoader(chain, *Assert(m_node.args));
}
std::unique_ptr<interfaces::Echo> makeEcho() override { return interfaces::MakeEcho(); }
+ const char* exeName() override { return EXE_NAME; }
node::NodeContext m_node;
};
} // namespace
diff --git a/src/init/bitcoind.cpp b/src/init/bitcoind.cpp
index 48be8831..0b0ab3f8 100644
--- a/src/init/bitcoind.cpp
+++ b/src/init/bitcoind.cpp
@@ -18,6 +18,8 @@ using node::NodeContext;
namespace init {
namespace {
+const char* EXE_NAME = "bitcoind";
+
class BitcoindInit : public interfaces::Init
{
public:
@@ -34,6 +36,7 @@ public:
return MakeWalletLoader(chain, *Assert(m_node.args));
}
std::unique_ptr<interfaces::Echo> makeEcho() override { return interfaces::MakeEcho(); }
+ const char* exeName() override { return EXE_NAME; }
NodeContext& m_node;
};
} // namespace
diff --git a/src/interfaces/init.h b/src/interfaces/init.h
index b496ada0..030ce306 100644
--- a/src/interfaces/init.h
+++ b/src/interfaces/init.h
@@ -38,6 +38,7 @@ public:
virtual std::unique_ptr<Echo> makeEcho() { return nullptr; }
virtual Ipc* ipc() { return nullptr; }
virtual bool canListenIpc() { return false; }
+ virtual const char* exeName() { return nullptr; }
};
//! Return implementation of Init interface for the node process. If the argv
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.