From 5f5550933f550f0135531f6d19c244e0bdcfda3d Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Mon, 7 Dec 2020 10:15:32 +0100 Subject: [PATCH 1/3] Merge #20468: build: warn when generating man pages for binaries built from a dirty branch 6690adba08006739da0060eb4937126bdfa1181a Warn when binaries are built from a dirty branch. (Tyler Chambers) Pull request description: - Adjusted `--version` flag behavior in bitcoind and bitcoin-wallet to have the same behavior. - Added `--version` flag to bitcoin-tx to match. - Added functionality in gen-manpages.sh to error when attempting to generate man pages for binaries built from a dirty branch. mitigates problem with issue #20412 ACKs for top commit: laanwj: Tested ACK 6690adba08006739da0060eb4937126bdfa1181a Tree-SHA512: b5ca509f1a57f66808c2bebc4b710ca00c6fec7b5ebd7eef58018e28e716f5f2358e36551b8a4df571bf3204baed565a297aeefb93990e7a99add502b97ee1b8 --- contrib/devtools/gen-manpages.sh | 16 ++++++++++++++++ src/bitcoin-tx.cpp | 16 ++++++++++------ src/bitcoin-wallet.cpp | 23 +++++++++++++---------- src/bitcoind.cpp | 10 +++++----- 4 files changed, 44 insertions(+), 21 deletions(-) diff --git a/contrib/devtools/gen-manpages.sh b/contrib/devtools/gen-manpages.sh index c5753e485586..5631a63f0254 100755 --- a/contrib/devtools/gen-manpages.sh +++ b/contrib/devtools/gen-manpages.sh @@ -18,6 +18,22 @@ BITCOINQT=${BITCOINQT:-$BINDIR/qt/dash-qt} [ ! -x $BITCOIND ] && echo "$BITCOIND not found or not executable." && exit 1 +# Don't allow man pages to be generated for binaries built from a dirty tree +DIRTY="" +for cmd in $BITCOIND $BITCOINCLI $BITCOINTX $WALLET_TOOL $BITCOINQT; do + VERSION_OUTPUT=$($cmd --version) + if [[ $VERSION_OUTPUT == *"dirty"* ]]; then + DIRTY="${DIRTY}${cmd}\n" + fi +done +if [ -n "$DIRTY" ] +then + echo -e "WARNING: the following binaries were built from a dirty tree:\n" + echo -e $DIRTY + echo "man pages generated from dirty binaries should NOT be committed." + echo "To properly generate man pages, please commit your changes to the above binaries, rebuild them, then run this script again." +fi + # The autodetected version git tag can screw up manpage output a little bit read -r -a BTCVER <<< "$($BITCOINCLI --version | head -n1 | awk -F'[ -]' '{ print $6, $7 }')" diff --git a/src/bitcoin-tx.cpp b/src/bitcoin-tx.cpp index b5890316653b..5574d42bf752 100644 --- a/src/bitcoin-tx.cpp +++ b/src/bitcoin-tx.cpp @@ -39,6 +39,7 @@ static void SetupBitcoinTxArgs(ArgsManager &argsman) { SetupHelpOptions(argsman); + argsman.AddArg("-version", "Print version and exit", ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS); argsman.AddArg("-create", "Create new, empty TX.", ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS); argsman.AddArg("-json", "Select JSON output", ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS); argsman.AddArg("-txid", "Output only the hex-encoded transaction id of the resultant transaction.", ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS); @@ -98,13 +99,16 @@ static int AppInitRawTx(int argc, char* argv[]) fCreateBlank = gArgs.GetBoolArg("-create", false); - if (argc < 2 || HelpRequested(gArgs)) { + if (argc < 2 || HelpRequested(gArgs) || gArgs.IsArgSet("-version")) { // First part of help message is specific to this utility - std::string strUsage = PACKAGE_NAME " dash-tx utility version " + FormatFullVersion() + "\n\n" + - "Usage: dash-tx [options] [commands] Update hex-encoded dash transaction\n" + - "or: dash-tx [options] -create [commands] Create hex-encoded dash transaction\n" + - "\n"; - strUsage += gArgs.GetHelpMessage(); + std::string strUsage = PACKAGE_NAME " dash-tx utility version " + FormatFullVersion() + "\n"; + if (!gArgs.IsArgSet("-version")) { + strUsage += "\n" + "Usage: dash-tx [options] [commands] Update hex-encoded dash transaction\n" + "or: dash-tx [options] -create [commands] Create hex-encoded dash transaction\n" + "\n"; + strUsage += gArgs.GetHelpMessage(); + } tfm::format(std::cout, "%s", strUsage); diff --git a/src/bitcoin-wallet.cpp b/src/bitcoin-wallet.cpp index 17572464f6be..e4a6b1b437ca 100644 --- a/src/bitcoin-wallet.cpp +++ b/src/bitcoin-wallet.cpp @@ -21,6 +21,7 @@ static void SetupWalletToolArgs(ArgsManager& argsman) SetupHelpOptions(argsman); SetupChainParamsBaseOptions(argsman); + argsman.AddArg("-version", "Print version and exit", ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS); argsman.AddArg("-datadir=", "Specify data directory", ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS); argsman.AddArg("-wallet=", "Specify wallet name", ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS); argsman.AddArg("-debug=", "Output debugging information (default: 0).", ArgsManager::ALLOW_ANY, OptionsCategory::DEBUG_TEST); @@ -42,16 +43,18 @@ static bool WalletAppInit(int argc, char* argv[]) tfm::format(std::cerr, "Error parsing command line arguments: %s\n", error_message); return false; } - if (argc < 2 || HelpRequested(gArgs)) { - std::string usage = strprintf("%s dash-wallet version", PACKAGE_NAME) + " " + FormatFullVersion() + "\n\n" + - "dash-wallet is an offline tool for creating and interacting with " PACKAGE_NAME " wallet files.\n" + - "By default dash-wallet will act on wallets in the default mainnet wallet directory in the datadir.\n" + - "To change the target wallet, use the -datadir, -wallet and -testnet/-regtest arguments.\n\n" + - "Usage:\n" + - " dash-wallet [options] \n\n" + - gArgs.GetHelpMessage(); - - tfm::format(std::cout, "%s", usage); + if (argc < 2 || HelpRequested(gArgs) || gArgs.IsArgSet("-version")) { + std::string strUsage = strprintf("%s dash-wallet version", PACKAGE_NAME) + " " + FormatFullVersion() + "\n"; + if (!gArgs.IsArgSet("-version")) { + strUsage += "\n" + "dash-wallet is an offline tool for creating and interacting with " PACKAGE_NAME " wallet files.\n" + "By default dash-wallet will act on wallets in the default mainnet wallet directory in the datadir.\n" + "To change the target wallet, use the -datadir, -wallet and -testnet/-regtest arguments.\n\n" + "Usage:\n" + " dash-wallet [options] \n"; + strUsage += "\n" + gArgs.GetHelpMessage(); + } + tfm::format(std::cout, "%s", strUsage); return false; } diff --git a/src/bitcoind.cpp b/src/bitcoind.cpp index cb2a86ff1f35..cdbb72abbaf6 100644 --- a/src/bitcoind.cpp +++ b/src/bitcoind.cpp @@ -59,11 +59,11 @@ static bool AppInit(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"; - } else { - strUsage += "\nUsage: dashd [options] Start " PACKAGE_NAME "\n"; - strUsage += "\n" + args.GetHelpMessage(); + if (!args.IsArgSet("-version")) { + strUsage += FormatParagraph(LicenseInfo()) + "\n" + "\nUsage: dashd [options] Start " PACKAGE_NAME "\n" + "\n"; + strUsage += args.GetHelpMessage(); } tfm::format(std::cout, "%s", strUsage); From b25fa7dcb9b48d2fdc82ac4a23e5897fdff7f26b Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Mon, 7 Dec 2020 13:54:49 +0100 Subject: [PATCH 2/3] Merge #20568: doc: Use FeeModes doc helper in estimatesmartfee fa8abdc9953e381715493b259908e246914793b0 rpc: Use FeeModes doc helper in estimatesmartfee (MarcoFalke) Pull request description: Not sure why this doesn't use the doc helper, probably an oversight? ACKs for top commit: laanwj: Code review ACK fa8abdc9953e381715493b259908e246914793b0 Tree-SHA512: 1f2dc8356e3476ddcf9cafafa7f9865ad95bed1e3067c0edab8e3c483e374bdbdbecc066167554b4a1b479e28f6a52c4ae6a75a70c67ee4e1ff4f3ba36b04001 --- src/rpc/mining.cpp | 8 +++----- test/functional/rpc_estimatefee.py | 2 ++ 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/rpc/mining.cpp b/src/rpc/mining.cpp index 68299cf67b4d..3ae7a716afa8 100644 --- a/src/rpc/mining.cpp +++ b/src/rpc/mining.cpp @@ -1074,15 +1074,13 @@ static UniValue estimatesmartfee(const JSONRPCRequest& request) "for which the estimate is valid.\n", { {"conf_target", RPCArg::Type::NUM, RPCArg::Optional::NO, "Confirmation target in blocks (1 - 1008)"}, - {"estimate_mode", RPCArg::Type::STR, /* default */ "CONSERVATIVE", "The fee estimate mode.\n" + {"estimate_mode", RPCArg::Type::STR, /* default */ "conservative", "The fee estimate mode.\n" " Whether to return a more conservative estimate which also satisfies\n" " a longer history. A conservative estimate potentially returns a\n" " higher feerate and is more likely to be sufficient for the desired\n" " target, but is not as responsive to short term drops in the\n" - " prevailing fee market. Must be one of:\n" - " \"UNSET\"\n" - " \"ECONOMICAL\"\n" - " \"CONSERVATIVE\""}, + " prevailing fee market. Must be one of (case insensitive):\n" + "\"" + FeeModes("\"\n\"") + "\""}, }, RPCResult{ RPCResult::Type::OBJ, "", "", diff --git a/test/functional/rpc_estimatefee.py b/test/functional/rpc_estimatefee.py index 8bdecfc8cda4..14a04aa1cff5 100755 --- a/test/functional/rpc_estimatefee.py +++ b/test/functional/rpc_estimatefee.py @@ -41,6 +41,8 @@ def run_test(self): self.nodes[0].estimatesmartfee(1) # self.nodes[0].estimatesmartfee(1, None) self.nodes[0].estimatesmartfee(1, 'ECONOMICAL') + self.nodes[0].estimatesmartfee(1, 'unset') + self.nodes[0].estimatesmartfee(1, 'conservative') self.nodes[0].estimaterawfee(1) self.nodes[0].estimaterawfee(1, None) From 361d1e18d1507a208a47107e0f7d929b9155b996 Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Wed, 9 Dec 2020 16:22:03 +0100 Subject: [PATCH 3/3] Merge #20606: Remove unused bits from service flags enum fa40168ab3102b9ad850f967a0e7fa22dbfbd0c6 Remove unused bits from service flags enum (MarcoFalke) Pull request description: Remove service bits that haven't been observed on the active network for years and won't ever be observed on the network with this meaning. Keeping this dead assignment in our source code forever doesn't add any value. I somehow forgot to do this in commit fa0d0ff6e1bee60fde63724ae28a51aac5a94d4a. ACKs for top commit: laanwj: Code review ACK fa40168ab3102b9ad850f967a0e7fa22dbfbd0c6 practicalswift: cr ACK fa40168ab3102b9ad850f967a0e7fa22dbfbd0c6 fanquake: ACK fa40168ab3102b9ad850f967a0e7fa22dbfbd0c6 Tree-SHA512: 376e5ac05940493cf2209fea60515c843e978c4b476f2524f6bf7a37a646d237c3ddcf6c0fa23641f9ba550f625609703d9b51b4be631a7f2a90e1092b557232 --- src/protocol.cpp | 1 - src/protocol.h | 4 ---- src/test/util/net.h | 1 - test/functional/test_framework/messages.py | 1 - 4 files changed, 7 deletions(-) diff --git a/src/protocol.cpp b/src/protocol.cpp index ae4ac612c8f4..49a87c50a0d5 100644 --- a/src/protocol.cpp +++ b/src/protocol.cpp @@ -368,7 +368,6 @@ static std::string serviceFlagToStr(size_t bit) switch ((ServiceFlags)service_flag) { case NODE_NONE: abort(); // impossible case NODE_NETWORK: return "NETWORK"; - case NODE_GETUTXO: return "GETUTXO"; case NODE_BLOOM: return "BLOOM"; case NODE_COMPACT_FILTERS: return "COMPACT_FILTERS"; case NODE_NETWORK_LIMITED: return "NETWORK_LIMITED"; diff --git a/src/protocol.h b/src/protocol.h index 265228b1f0f2..106d038b2899 100644 --- a/src/protocol.h +++ b/src/protocol.h @@ -310,10 +310,6 @@ enum ServiceFlags : uint64_t { // NODE_NETWORK means that the node is capable of serving the complete block chain. It is currently // set by all Dash Core non pruned nodes, and is unset by SPV clients or other light clients. NODE_NETWORK = (1 << 0), - // NODE_GETUTXO means the node is capable of responding to the getutxo protocol request. - // Dash Core does not support this but a patch set called Bitcoin XT does. - // See BIP 64 for details on how this is implemented. - NODE_GETUTXO = (1 << 1), // NODE_BLOOM means the node is capable and willing to handle bloom-filtered connections. // Dash Core nodes used to support this by default, without advertising this bit, // but no longer do as of protocol version 70201 (= NO_BLOOM_VERSION) diff --git a/src/test/util/net.h b/src/test/util/net.h index 0cdebe467847..da0eec8be275 100644 --- a/src/test/util/net.h +++ b/src/test/util/net.h @@ -39,7 +39,6 @@ struct ConnmanTestMsg : public CConnman { constexpr ServiceFlags ALL_SERVICE_FLAGS[]{ NODE_NONE, NODE_NETWORK, - NODE_GETUTXO, NODE_BLOOM, NODE_COMPACT_FILTERS, NODE_NETWORK_LIMITED, diff --git a/test/functional/test_framework/messages.py b/test/functional/test_framework/messages.py index 8a28d5c00826..f339f13d5c53 100755 --- a/test/functional/test_framework/messages.py +++ b/test/functional/test_framework/messages.py @@ -45,7 +45,6 @@ BIP125_SEQUENCE_NUMBER = 0xfffffffd # Sequence number that is BIP 125 opt-in and BIP 68-opt-out NODE_NETWORK = (1 << 0) -NODE_GETUTXO = (1 << 1) NODE_BLOOM = (1 << 2) NODE_COMPACT_FILTERS = (1 << 6) NODE_NETWORK_LIMITED = (1 << 10)