Merge bitcoin/bitcoin#22715: wallet: use FormatFullVersion() & PACKAGE_NAME in dumpwallet

2d7534bd93ec78609e187beaea64f1d1bdb1f81a wallet: use PACKAGE_NAME instead of "Bitcoin" in rpcdump (fanquake)
14b480240539eee8d296ed1ac6ec674b34635433 wallet: use FormatFullVersion instead of CLIENT_BUILD in rpcdump (fanquake)

Pull request description:

  The dumpwallet RPC is the last place we're using CLIENT_BUILD directly, rather FormatFullVersion() (which just returns it), so switch to using that. At the same time, use PACKAGE_NAME (Bitcoin Core), rather than just "Bitcoin".

ACKs for top commit:
  MarcoFalke:
    cr ACK 2d7534bd93ec78609e187beaea64f1d1bdb1f81a
  laanwj:
    Tested ACK 2d7534bd93ec78609e187beaea64f1d1bdb1f81a
  achow101:
    ACK 2d7534bd93ec78609e187beaea64f1d1bdb1f81a
  Zero-1729:
    crACK 2d7534b

Tree-SHA512: b38ee074e317448719d2a628380786ec665413515b38d9ce680c21608bc2acf6a2bf817f78f100a8310477613ae72d6969cc4f595f4f44af0896659d3ebf2671
This commit is contained in:
fanquake 2021-08-17 08:52:16 +08:00 committed by pasta
parent 783a6bd842
commit a640c6585a
No known key found for this signature in database
GPG Key ID: 52527BEDABE87984
3 changed files with 4 additions and 5 deletions

View File

@ -43,8 +43,6 @@ const std::string CLIENT_NAME("Dash Core");
#endif
#endif
const std::string CLIENT_BUILD(BUILD_DESC BUILD_SUFFIX);
std::string FormatVersion(int nVersion)
{
return strprintf("%d.%d.%d", nVersion / 10000, (nVersion / 100) % 100, nVersion % 100);
@ -52,6 +50,7 @@ std::string FormatVersion(int nVersion)
std::string FormatFullVersion()
{
static const std::string CLIENT_BUILD(BUILD_DESC BUILD_SUFFIX);
return CLIENT_BUILD;
}

View File

@ -36,7 +36,6 @@ static const int CLIENT_VERSION =
+ 1 * CLIENT_VERSION_BUILD;
extern const std::string CLIENT_NAME;
extern const std::string CLIENT_BUILD;
std::string FormatVersion(int nVersion);
std::string FormatFullVersion();

View File

@ -4,6 +4,7 @@
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <chain.h>
#include <clientversion.h>
#include <core_io.h>
#include <interfaces/chain.h>
#include <key_io.h>
@ -981,14 +982,14 @@ RPCHelpMan dumpwallet()
std::sort(vKeyBirth.begin(), vKeyBirth.end());
// produce output
file << strprintf("# Wallet dump created by Dash Core %s\n", CLIENT_BUILD);
file << strprintf("# Wallet dump created by %s %s\n", PACKAGE_NAME, FormatFullVersion());
file << strprintf("# * Created on %s\n", FormatISO8601DateTime(GetTime()));
file << strprintf("# * Best block at time of backup was %i (%s),\n", wallet.GetLastBlockHeight(), wallet.GetLastBlockHash().ToString());
file << strprintf("# mined on %s\n", FormatISO8601DateTime(block_time));
file << "\n";
UniValue obj(UniValue::VOBJ);
obj.pushKV("dashcoreversion", CLIENT_BUILD);
obj.pushKV("dashcoreversion", FormatFullVersion());
obj.pushKV("lastblockheight", wallet.GetLastBlockHeight());
obj.pushKV("lastblockhash", wallet.GetLastBlockHash().ToString());
obj.pushKV("lastblocktime", block_time);