Skip to content

Commit

Permalink
X# This is a combination of 9 commits.
Browse files Browse the repository at this point in the history
[ZEND-517] Unnecessary log lines removal

Client version print addition

Client version print format change

Mentioned in release notes
  • Loading branch information
Tytus Bierwiaczonek authored and titusen committed May 30, 2023
1 parent f53067e commit cf7a723
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 14 deletions.
21 changes: 16 additions & 5 deletions src/clientversion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,14 +102,25 @@ const std::string CLIENT_DATE(BUILD_DATE);

std::string FormatVersion(int nVersion)
{
if (nVersion % 100 < 25)
return strprintf("%d.%d.%d-beta%d", nVersion / 1000000, (nVersion / 10000) % 100, (nVersion / 100) % 100, (nVersion % 100)+1);
if (nVersion % 100 < 50)
if (nVersion % 100 == 0)
{
return strprintf("%d.%d.%d-alpha", nVersion / 1000000, (nVersion / 10000) % 100, (nVersion / 100) % 100);
}
else if (nVersion % 100 < 25)
{
return strprintf("%d.%d.%d-beta%d", nVersion / 1000000, (nVersion / 10000) % 100, (nVersion / 100) % 100, (nVersion % 100));
}
else if (nVersion % 100 < 50)
{
return strprintf("%d.%d.%d-rc%d", nVersion / 1000000, (nVersion / 10000) % 100, (nVersion / 100) % 100, (nVersion % 100)-24);
else if (nVersion % 100 == 50)
}
else if (nVersion % 100 == 50)
{
return strprintf("%d.%d.%d", nVersion / 1000000, (nVersion / 10000) % 100, (nVersion / 100) % 100);
else
}
else {
return strprintf("%d.%d.%d-%d", nVersion / 1000000, (nVersion / 10000) % 100, (nVersion / 100) % 100, (nVersion % 100)-50);
}
}

std::string FormatFullVersion()
Expand Down
2 changes: 0 additions & 2 deletions src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -957,8 +957,6 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
fLogTimeMicros = GetBoolArg("-logtimemicros", false);
fLogIPs = GetBoolArg("-logips", false);

LogPrintf("Horizen version %s (%s)\n", FormatFullVersion(), CLIENT_DATE);

// when specifying an explicit binding address, you want to listen on it
// even when -connect or -proxy is specified
if (mapArgs.count("-bind")) {
Expand Down
7 changes: 4 additions & 3 deletions src/metrics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "utiltime.h"
#include "utilmoneystr.h"
#include "utilstrencodings.h"
#include "clientversion.h"

#include <boost/thread.hpp>
#include <boost/thread/synchronized_value.hpp>
Expand Down Expand Up @@ -517,9 +518,9 @@ void ThreadShowMetricsScreen()

// Thank you text
std::cout << _("Zen is economic freedom. Thanks for running a node.") << std::endl;
std::cout << _("仕方が無い") << std::endl;
std::cout << _("Shikata ga nai.") << std::endl;
std::cout << _("它不能得到帮助") << std::endl << std::endl;

std::cout << "Software Version: " << FormatVersion(CLIENT_VERSION);
std::cout << std::endl;

// Privacy notice text
std::cout << PrivacyInfo();
Expand Down
9 changes: 5 additions & 4 deletions src/test/util_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -414,16 +414,17 @@ BOOST_AUTO_TEST_CASE(test_FormatSubVersion)
std::vector<std::string> comments2;
comments2.push_back(std::string("comment1"));
comments2.push_back(std::string("comment2"));
BOOST_CHECK_EQUAL(FormatSubVersion("Test", 99900, std::vector<std::string>()), std::string("/Test:0.9.99-beta1/"));
BOOST_CHECK_EQUAL(FormatSubVersion("Test", 99924, std::vector<std::string>()), std::string("/Test:0.9.99-beta25/"));
BOOST_CHECK_EQUAL(FormatSubVersion("Test", 99900, std::vector<std::string>()), std::string("/Test:0.9.99-alpha/"));
BOOST_CHECK_EQUAL(FormatSubVersion("Test", 99924, std::vector<std::string>()), std::string("/Test:0.9.99-beta24/"));
BOOST_CHECK_EQUAL(FormatSubVersion("Test", 99925, std::vector<std::string>()), std::string("/Test:0.9.99-rc1/"));
BOOST_CHECK_EQUAL(FormatSubVersion("Test", 99949, std::vector<std::string>()), std::string("/Test:0.9.99-rc25/"));
BOOST_CHECK_EQUAL(FormatSubVersion("Test", 99950, std::vector<std::string>()), std::string("/Test:0.9.99/"));
BOOST_CHECK_EQUAL(FormatSubVersion("Test", 99951, std::vector<std::string>()), std::string("/Test:0.9.99-1/"));
BOOST_CHECK_EQUAL(FormatSubVersion("Test", 99999, std::vector<std::string>()), std::string("/Test:0.9.99-49/"));
BOOST_CHECK_EQUAL(FormatSubVersion("Test", 99900, comments), std::string("/Test:0.9.99-beta1(comment1)/"));
BOOST_CHECK_EQUAL(FormatSubVersion("Test", 99900, comments), std::string("/Test:0.9.99-alpha(comment1)/"));
BOOST_CHECK_EQUAL(FormatSubVersion("Test", 99950, comments), std::string("/Test:0.9.99(comment1)/"));
BOOST_CHECK_EQUAL(FormatSubVersion("Test", 99900, comments2), std::string("/Test:0.9.99-beta1(comment1; comment2)/"));
BOOST_CHECK_EQUAL(FormatSubVersion("Test", 99924, comments2), std::string("/Test:0.9.99-beta24(comment1; comment2)/"));
BOOST_CHECK_EQUAL(FormatSubVersion("Test", 99900, comments2), std::string("/Test:0.9.99-alpha(comment1; comment2)/"));
BOOST_CHECK_EQUAL(FormatSubVersion("Test", 99950, comments2), std::string("/Test:0.9.99(comment1; comment2)/"));
}

Expand Down

0 comments on commit cf7a723

Please sign in to comment.