aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/bench/examples.cpp2
-rw-r--r--src/bitcoin-cli.cpp5
-rw-r--r--src/bitcoin-tx.cpp5
-rw-r--r--src/bitcoin-util.cpp5
-rw-r--r--src/bitcoin-wallet.cpp5
-rw-r--r--src/bitcoind.cpp7
-rw-r--r--src/clientversion.cpp33
-rw-r--r--src/clientversion.h5
-rw-r--r--src/init.cpp19
-rw-r--r--src/init.h3
-rw-r--r--src/test/fuzz/addrman.cpp2
-rw-r--r--src/test/serialize_tests.cpp12
-rw-r--r--src/util/system.cpp12
-rw-r--r--src/util/system.h2
14 files changed, 66 insertions, 51 deletions
diff --git a/src/bench/examples.cpp b/src/bench/examples.cpp
index dcd615b9da..72a9922e94 100644
--- a/src/bench/examples.cpp
+++ b/src/bench/examples.cpp
@@ -13,7 +13,7 @@ static void Trig(benchmark::Bench& bench)
{
double d = 0.01;
bench.run([&] {
- sum += sin(d);
+ sum = sum + sin(d);
d += 0.000001;
});
}
diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp
index 874e38752a..5523fff3b2 100644
--- a/src/bitcoin-cli.cpp
+++ b/src/bitcoin-cli.cpp
@@ -133,7 +133,10 @@ static int AppInitRPC(int argc, char* argv[])
}
if (argc < 2 || HelpRequested(gArgs) || gArgs.IsArgSet("-version")) {
std::string strUsage = PACKAGE_NAME " RPC client version " + FormatFullVersion() + "\n";
- if (!gArgs.IsArgSet("-version")) {
+
+ if (gArgs.IsArgSet("-version")) {
+ strUsage += FormatParagraph(LicenseInfo());
+ } else {
strUsage += "\n"
"Usage: bitcoin-cli [options] <command> [params] Send command to " PACKAGE_NAME "\n"
"or: bitcoin-cli [options] -named <command> [name=value]... Send command to " PACKAGE_NAME " (with named arguments)\n"
diff --git a/src/bitcoin-tx.cpp b/src/bitcoin-tx.cpp
index ec07114d6e..b297081cab 100644
--- a/src/bitcoin-tx.cpp
+++ b/src/bitcoin-tx.cpp
@@ -102,7 +102,10 @@ static int AppInitRawTx(int argc, char* argv[])
if (argc < 2 || HelpRequested(gArgs) || gArgs.IsArgSet("-version")) {
// First part of help message is specific to this utility
std::string strUsage = PACKAGE_NAME " bitcoin-tx utility version " + FormatFullVersion() + "\n";
- if (!gArgs.IsArgSet("-version")) {
+
+ if (gArgs.IsArgSet("-version")) {
+ strUsage += FormatParagraph(LicenseInfo());
+ } else {
strUsage += "\n"
"Usage: bitcoin-tx [options] <hex-tx> [commands] Update hex-encoded bitcoin transaction\n"
"or: bitcoin-tx [options] -create [commands] Create hex-encoded bitcoin transaction\n"
diff --git a/src/bitcoin-util.cpp b/src/bitcoin-util.cpp
index 973f4f2883..b457e0b354 100644
--- a/src/bitcoin-util.cpp
+++ b/src/bitcoin-util.cpp
@@ -53,7 +53,10 @@ static int AppInitUtil(ArgsManager& args, int argc, char* argv[])
if (HelpRequested(args) || args.IsArgSet("-version")) {
// First part of help message is specific to this utility
std::string strUsage = PACKAGE_NAME " bitcoin-util utility version " + FormatFullVersion() + "\n";
- if (!args.IsArgSet("-version")) {
+
+ if (args.IsArgSet("-version")) {
+ strUsage += FormatParagraph(LicenseInfo());
+ } else {
strUsage += "\n"
"Usage: bitcoin-util [options] [commands] Do stuff\n";
strUsage += "\n" + args.GetHelpMessage();
diff --git a/src/bitcoin-wallet.cpp b/src/bitcoin-wallet.cpp
index ff5485e2da..2f3dd45267 100644
--- a/src/bitcoin-wallet.cpp
+++ b/src/bitcoin-wallet.cpp
@@ -59,7 +59,10 @@ static bool WalletAppInit(ArgsManager& args, int argc, char* argv[])
}
if (argc < 2 || HelpRequested(args) || args.IsArgSet("-version")) {
std::string strUsage = strprintf("%s bitcoin-wallet version", PACKAGE_NAME) + " " + FormatFullVersion() + "\n";
- if (!args.IsArgSet("-version")) {
+
+ if (args.IsArgSet("-version")) {
+ strUsage += FormatParagraph(LicenseInfo());
+ } else {
strUsage += "\n"
"bitcoin-wallet is an offline tool for creating and interacting with " PACKAGE_NAME " wallet files.\n"
"By default bitcoin-wallet will act on wallets in the default mainnet wallet directory in the datadir.\n"
diff --git a/src/bitcoind.cpp b/src/bitcoind.cpp
index 6432e8849d..9843382682 100644
--- a/src/bitcoind.cpp
+++ b/src/bitcoind.cpp
@@ -126,9 +126,10 @@ static bool AppInit(NodeContext& node, int argc, char* argv[])
if (HelpRequested(args) || args.IsArgSet("-version")) {
std::string strUsage = PACKAGE_NAME " version " + FormatFullVersion() + "\n";
- if (!args.IsArgSet("-version")) {
- strUsage += FormatParagraph(LicenseInfo()) + "\n"
- "\nUsage: bitcoind [options] Start " PACKAGE_NAME "\n"
+ if (args.IsArgSet("-version")) {
+ strUsage += FormatParagraph(LicenseInfo());
+ } else {
+ strUsage += "\nUsage: bitcoind [options] Start " PACKAGE_NAME "\n"
"\n";
strUsage += args.GetHelpMessage();
}
diff --git a/src/clientversion.cpp b/src/clientversion.cpp
index 9b65952b02..192e9c52bc 100644
--- a/src/clientversion.cpp
+++ b/src/clientversion.cpp
@@ -3,9 +3,13 @@
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <clientversion.h>
+#include <util/translation.h>
#include <tinyformat.h>
+#include <sstream>
+#include <string>
+#include <vector>
/**
* Name of client reported in the 'version' message. Report the same name
@@ -72,3 +76,32 @@ std::string FormatSubVersion(const std::string& name, int nClientVersion, const
ss << "/";
return ss.str();
}
+
+std::string CopyrightHolders(const std::string& strPrefix)
+{
+ const auto copyright_devs = strprintf(_(COPYRIGHT_HOLDERS).translated, COPYRIGHT_HOLDERS_SUBSTITUTION);
+ std::string strCopyrightHolders = strPrefix + copyright_devs;
+
+ // Make sure Bitcoin Core copyright is not removed by accident
+ if (copyright_devs.find("Bitcoin Core") == std::string::npos) {
+ strCopyrightHolders += "\n" + strPrefix + "The Bitcoin Core developers";
+ }
+ return strCopyrightHolders;
+}
+
+std::string LicenseInfo()
+{
+ const std::string URL_SOURCE_CODE = "<https://github.com/bitcoin/bitcoin>";
+
+ return CopyrightHolders(strprintf(_("Copyright (C) %i-%i").translated, 2009, COPYRIGHT_YEAR) + " ") + "\n" +
+ "\n" +
+ strprintf(_("Please contribute if you find %s useful. "
+ "Visit %s for further information about the software.").translated, PACKAGE_NAME, "<" PACKAGE_URL ">") +
+ "\n" +
+ strprintf(_("The source code is available from %s.").translated, URL_SOURCE_CODE) +
+ "\n" +
+ "\n" +
+ _("This is experimental software.").translated + "\n" +
+ strprintf(_("Distributed under the MIT software license, see the accompanying file %s or %s").translated, "COPYING", "<https://opensource.org/licenses/MIT>") +
+ "\n";
+}
diff --git a/src/clientversion.h b/src/clientversion.h
index a39d96292d..d2efd7dcab 100644
--- a/src/clientversion.h
+++ b/src/clientversion.h
@@ -41,6 +41,11 @@ extern const std::string CLIENT_NAME;
std::string FormatFullVersion();
std::string FormatSubVersion(const std::string& name, int nClientVersion, const std::vector<std::string>& comments);
+std::string CopyrightHolders(const std::string& strPrefix);
+
+/** Returns licensing information (for -version) */
+std::string LicenseInfo();
+
#endif // WINDRES_PREPROC
#endif // BITCOIN_CLIENTVERSION_H
diff --git a/src/init.cpp b/src/init.cpp
index 64ed868333..02ea30e28e 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -594,25 +594,6 @@ void SetupServerArgs(ArgsManager& argsman)
argsman.AddHiddenArgs(hidden_args);
}
-std::string LicenseInfo()
-{
- const std::string URL_SOURCE_CODE = "<https://github.com/bitcoin/bitcoin>";
-
- return CopyrightHolders(strprintf(_("Copyright (C) %i-%i").translated, 2009, COPYRIGHT_YEAR) + " ") + "\n" +
- "\n" +
- strprintf(_("Please contribute if you find %s useful. "
- "Visit %s for further information about the software.").translated,
- PACKAGE_NAME, "<" PACKAGE_URL ">") +
- "\n" +
- strprintf(_("The source code is available from %s.").translated,
- URL_SOURCE_CODE) +
- "\n" +
- "\n" +
- _("This is experimental software.").translated + "\n" +
- strprintf(_("Distributed under the MIT software license, see the accompanying file %s or %s").translated, "COPYING", "<https://opensource.org/licenses/MIT>") +
- "\n";
-}
-
static bool fHaveGenesis = false;
static Mutex g_genesis_wait_mutex;
static std::condition_variable g_genesis_wait_cv;
diff --git a/src/init.h b/src/init.h
index 1292cc1a3a..ddd439f619 100644
--- a/src/init.h
+++ b/src/init.h
@@ -70,7 +70,4 @@ bool AppInitMain(node::NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip
*/
void SetupServerArgs(ArgsManager& argsman);
-/** Returns licensing information (for -version) */
-std::string LicenseInfo();
-
#endif // BITCOIN_INIT_H
diff --git a/src/test/fuzz/addrman.cpp b/src/test/fuzz/addrman.cpp
index 3699abb597..ba917dec2a 100644
--- a/src/test/fuzz/addrman.cpp
+++ b/src/test/fuzz/addrman.cpp
@@ -137,7 +137,7 @@ public:
* - vvNew entries refer to the same addresses
* - vvTried entries refer to the same addresses
*/
- bool operator==(const AddrManDeterministic& other)
+ bool operator==(const AddrManDeterministic& other) const
{
LOCK2(m_impl->cs, other.m_impl->cs);
diff --git a/src/test/serialize_tests.cpp b/src/test/serialize_tests.cpp
index 2441847f99..8c7c650cb1 100644
--- a/src/test/serialize_tests.cpp
+++ b/src/test/serialize_tests.cpp
@@ -38,13 +38,13 @@ public:
READWRITE(obj.txval);
}
- bool operator==(const CSerializeMethodsTestSingle& rhs)
+ bool operator==(const CSerializeMethodsTestSingle& rhs) const
{
- return intval == rhs.intval && \
- boolval == rhs.boolval && \
- stringval == rhs.stringval && \
- strcmp(charstrval, rhs.charstrval) == 0 && \
- *txval == *rhs.txval;
+ return intval == rhs.intval &&
+ boolval == rhs.boolval &&
+ stringval == rhs.stringval &&
+ strcmp(charstrval, rhs.charstrval) == 0 &&
+ *txval == *rhs.txval;
}
};
diff --git a/src/util/system.cpp b/src/util/system.cpp
index 69811a751b..aa9122106b 100644
--- a/src/util/system.cpp
+++ b/src/util/system.cpp
@@ -1342,18 +1342,6 @@ int GetNumCores()
return std::thread::hardware_concurrency();
}
-std::string CopyrightHolders(const std::string& strPrefix)
-{
- const auto copyright_devs = strprintf(_(COPYRIGHT_HOLDERS).translated, COPYRIGHT_HOLDERS_SUBSTITUTION);
- std::string strCopyrightHolders = strPrefix + copyright_devs;
-
- // Make sure Bitcoin Core copyright is not removed by accident
- if (copyright_devs.find("Bitcoin Core") == std::string::npos) {
- strCopyrightHolders += "\n" + strPrefix + "The Bitcoin Core developers";
- }
- return strCopyrightHolders;
-}
-
// Obtain the application startup time (used for uptime calculation)
int64_t GetStartupTime()
{
diff --git a/src/util/system.h b/src/util/system.h
index a72ba3f3ed..f193c8ac0b 100644
--- a/src/util/system.h
+++ b/src/util/system.h
@@ -512,8 +512,6 @@ std::string HelpMessageOpt(const std::string& option, const std::string& message
*/
int GetNumCores();
-std::string CopyrightHolders(const std::string& strPrefix);
-
/**
* On platforms that support it, tell the kernel the calling thread is
* CPU-intensive and non-interactive. See SCHED_BATCH in sched(7) for details.