From 19e3ee894e2a5c3e20d91796b1373b8e705fa6d2 Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Fri, 18 Feb 2022 07:32:03 +0100 Subject: [PATCH 1/5] Merge bitcoin/bitcoin#24360: doc: improve -netinfo help based on feedback from users and devs a4da16fbd43ea1fff344f1602f7a5ace3d4a8a95 Improve -netinfo help based on feedback from users and devs (Jon Atack) Pull request description: Clarify which networks are displayed by the peer counts table (*reachable* networks; follow-up to #23324) in response to questions received over the past months, and a few other improvements. ACKs for top commit: laanwj: Code review ACK a4da16fbd43ea1fff344f1602f7a5ace3d4a8a95 w0xlt: ACK a4da16f kristapsk: utACK a4da16fbd43ea1fff344f1602f7a5ace3d4a8a95 Tree-SHA512: e6522c08421aa7f10d50723156d0a8fc5ec82cad2f0bd931bbec603077fcd4921c6505ef743d57386fba81c95dcfc77df75abf3378319886368e4ae33f9a6d73 --- src/bitcoin-cli.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp index cd691e151c..7fd90f7434 100644 --- a/src/bitcoin-cli.cpp +++ b/src/bitcoin-cli.cpp @@ -640,8 +640,9 @@ public: "Suggestion: use with the Linux watch(1) command for a live dashboard; see example below.\n\n" "Arguments:\n" + strprintf("1. level (integer 0-%d, optional) Specify the info level of the peers dashboard (default 0):\n", MAX_DETAIL_LEVEL) + - " 0 - Connection counts and local addresses\n" - " 1 - Like 0 but with a peers listing (without address or version columns)\n" + " 0 - Peer counts for each reachable network as well as for block relay peers\n" + " and manual peers, and the list of local addresses and ports\n" + " 1 - Like 0 but preceded by a peers listing (without address and version columns)\n" " 2 - Like 1 but with an address column\n" " 3 - Like 1 but with a version column\n" " 4 - Like 1 but with both address and version columns\n" @@ -680,13 +681,13 @@ public: " id Peer index, in increasing order of peer connections since node startup\n" " address IP address and port of the peer\n" " version Peer version and subversion concatenated, e.g. \"70016/Satoshi:21.0.0/\"\n\n" - "* The connection counts table displays the number of peers by direction, network, and the totals\n" - " for each, as well as two special outbound columns for block relay peers and manual peers.\n\n" + "* The peer counts table displays the number of peers for each reachable network as well as\n" + " the number of block relay peers and manual peers.\n\n" "* The local addresses table lists each local address broadcast by the node, the port, and the score.\n\n" "Examples:\n\n" - "Connection counts and local addresses only\n" + "Peer counts table of reachable networks and list of local addresses\n" "> dash-cli -netinfo\n\n" - "Compact peers listing\n" + "The same, preceded by a peers listing without address and version columns\n" "> dash-cli -netinfo 1\n\n" "Full dashboard\n" + strprintf("> dash-cli -netinfo %d\n\n", MAX_DETAIL_LEVEL) + From f1c5ab1fcbe6831784e0076812a7015ae7d24fb3 Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Mon, 21 Feb 2022 07:52:24 +0100 Subject: [PATCH 2/5] Merge bitcoin/bitcoin#24347: rpc: Fix implicit-integer-sign-change in verifychain fa8dad0e078c577d740a9667636733957586c035 rpc: Fix implicit-integer-sign-change in verifychain (MarcoFalke) Pull request description: It doesn't really make sense to treat `DEFAULT_CHECKLEVEL` as unsigned as long as `VerifyDB` accepts a signed integer. Making it signed also avoids a cast round trip from signed->unsigned->signed in the RPC. ACKs for top commit: luke-jr: utACK fa8dad0e078c577d740a9667636733957586c035 theStack: Code-review ACK fa8dad0e078c577d740a9667636733957586c035 Tree-SHA512: 75499dbe4ace2962792e5fbec7defb10c25fdbbfde951d5e542a91daa880cc50395da0287173e2c84a28e18267c74af7b44b9f38ce364bcb0216c402f65b7641 --- src/rpc/blockchain.cpp | 2 +- src/validation.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp index 5c3890a0c9..d6013a6a4c 100644 --- a/src/rpc/blockchain.cpp +++ b/src/rpc/blockchain.cpp @@ -1632,7 +1632,7 @@ static RPCHelpMan verifychain() }, [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue { - const int check_level(request.params[0].isNull() ? DEFAULT_CHECKLEVEL : request.params[0].get_int()); + const int check_level{request.params[0].isNull() ? DEFAULT_CHECKLEVEL : request.params[0].get_int()}; const int check_depth{request.params[1].isNull() ? DEFAULT_CHECKBLOCKS : request.params[1].get_int()}; const NodeContext& node = EnsureAnyNodeContext(request.context); diff --git a/src/validation.h b/src/validation.h index fd9bf01d89..1644549a3c 100644 --- a/src/validation.h +++ b/src/validation.h @@ -104,7 +104,7 @@ static const int DEFAULT_STOPATHEIGHT = 0; /** Block files containing a block-height within MIN_BLOCKS_TO_KEEP of ActiveChain().Tip() will not be pruned. */ static const unsigned int MIN_BLOCKS_TO_KEEP = 288; static const signed int DEFAULT_CHECKBLOCKS = 6; -static const unsigned int DEFAULT_CHECKLEVEL = 3; +static constexpr int DEFAULT_CHECKLEVEL{3}; // Require that user allocate at least 945 MiB for block & undo files (blk???.dat and rev???.dat) // At 2B MiB per block, 288 blocks = 576 MiB. From 21cea475d8e3ef05261624eb79cffa7a8e72d5a1 Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Mon, 21 Feb 2022 08:14:41 +0100 Subject: [PATCH 3/5] Merge bitcoin/bitcoin#24376: doc: bitcoin-wallet fixes (help output and code comment) 62cc138ecb9cc7afcbe6fdb42b060a8f149826de Rename wallet-tool to bitcoin-wallet in code comment (Kristaps Kaupe) 0db3ad3ba41a76dff80bcb5f292e587da400ebf1 Mention -signet in bitcoin-wallet help output (Kristaps Kaupe) Pull request description: * Mention `-signet` in sentence where there is already `-testnet/-signet` in help output. * Rename `wallet-tool` to `bitcoin-wallet` in single remaining place in code comments (was already done in #17648 at other places). ACKs for top commit: RandyMcMillan: tACK 62cc138ecb Tree-SHA512: c5df7811b8200f61943908dcf3b2b788fe991bf00bef28f069ab8784924556ffd5d86fc0ba2ad0b3c3f9be2ba73a34bc67059d7c057bba646c1801ffa3cb2070 --- src/bitcoin-wallet.cpp | 2 +- src/wallet/wallet.cpp | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/bitcoin-wallet.cpp b/src/bitcoin-wallet.cpp index 176b455ce9..8e7c1490fd 100644 --- a/src/bitcoin-wallet.cpp +++ b/src/bitcoin-wallet.cpp @@ -56,7 +56,7 @@ static bool WalletAppInit(ArgsManager& args, int argc, char* argv[]) 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" + "To change the target wallet, use the -datadir, -wallet and -regtest/-testnet arguments.\n\n" "Usage:\n" " dash-wallet [options] \n"; strUsage += "\n" + args.GetHelpMessage(); diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 346a2ec199..874b000c86 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1019,7 +1019,8 @@ bool CWallet::LoadToWallet(const uint256& hash, const UpdateWalletTxFn& fill_wtx if (!fill_wtx(wtx, ins.second)) { return false; } - // If wallet doesn't have a chain (e.g dash-wallet), don't bother to update txn. + // If wallet doesn't have a chain (e.g when using dash-wallet tool), + // don't bother to update txn. if (HaveChain()) { bool active; int height; From d0e0381dfae8a3ba955c745a3290769a5eadd326 Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Mon, 21 Feb 2022 16:44:17 +0100 Subject: [PATCH 4/5] Merge bitcoin/bitcoin#24370: rpc, cli: describe quality/recency filtering in getnodeaddresses and -addrinfo ce690847b69eb80b0232f818152dbb1db7c4c61a cli: describe quality/recency filtering in -addrinfo (Jon Atack) 7c975614c0fc6ff2084a1708a4c1f0368a4bc98f rpc: describe quality/recency filtering in getnodeaddresses (Jon Atack) Pull request description: Addresses #24278. ``` $ bitcoin-cli help getnodeaddresses getnodeaddresses ( count "network" ) Return known addresses, after filtering for quality and recency. These can potentially be used to find new peers in the network. The total number of addresses known to the node may be higher. ``` ``` $ bitcoin-cli -help | grep -A3 addrinfo -addrinfo Get the number of addresses known to the node, per network and total, after filtering for quality and recency. The total number of addresses known to the node may be higher. ``` ACKs for top commit: mzumsande: Thanks, Code Review ACK ce690847b69eb80b0232f818152dbb1db7c4c61a prayank23: reACK https://github.com/bitcoin/bitcoin/pull/24370/commits/ce690847b69eb80b0232f818152dbb1db7c4c61a Tree-SHA512: 82d23b15e64a99411eb8e70d7267a1b4f23182fabe072e824277569d9677e392b466be63f00e3d157d7db94bbe032d53f12ad4ab30b55b7b8a629c37d80d1d8c --- src/bitcoin-cli.cpp | 2 +- src/rpc/net.cpp | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp index 7fd90f7434..29c4c7b9be 100644 --- a/src/bitcoin-cli.cpp +++ b/src/bitcoin-cli.cpp @@ -75,7 +75,7 @@ static void SetupCliArgs(ArgsManager& argsman) argsman.AddArg("-conf=", strprintf("Specify configuration file. Relative paths will be prefixed by datadir location. (default: %s)", BITCOIN_CONF_FILENAME), ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS); argsman.AddArg("-datadir=", "Specify data directory", ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS); argsman.AddArg("-generate", strprintf("Generate blocks immediately, equivalent to RPC getnewaddress followed by RPC generatetoaddress. Optional positional integer arguments are number of blocks to generate (default: %s) and maximum iterations to try (default: %s), equivalent to RPC generatetoaddress nblocks and maxtries arguments. Example: dash-cli -generate 4 1000", DEFAULT_NBLOCKS, DEFAULT_MAX_TRIES), ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS); - argsman.AddArg("-addrinfo", "Get the number of addresses known to the node, per network and total.", ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS); + argsman.AddArg("-addrinfo", "Get the number of addresses known to the node, per network and total, after filtering for quality and recency. The total number of addresses known to the node may be higher.", ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS); argsman.AddArg("-getinfo", "Get general information from the remote server. Note that unlike server-side RPC calls, the results of -getinfo is the result of multiple non-atomic requests. Some entries in the result may represent results from different states (e.g. wallet balance may be as of a different block from the chain state reported)", ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS); argsman.AddArg("-netinfo", "Get network peer connection information from the remote server. An optional integer argument from 0 to 4 can be passed for different peers listings (default: 0). Pass \"help\" for detailed help documentation.", ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS); diff --git a/src/rpc/net.cpp b/src/rpc/net.cpp index ecb1441ee6..1c4f479410 100644 --- a/src/rpc/net.cpp +++ b/src/rpc/net.cpp @@ -922,7 +922,9 @@ static RPCHelpMan setnetworkactive() static RPCHelpMan getnodeaddresses() { return RPCHelpMan{"getnodeaddresses", - "\nReturn known addresses, which can potentially be used to find new nodes in the network.\n", + "Return known addresses, after filtering for quality and recency.\n" + "These can potentially be used to find new peers in the network.\n" + "The total number of addresses known to the node may be higher.", { {"count", RPCArg::Type::NUM, RPCArg::Default{1}, "The maximum number of addresses to return. Specify 0 to return all known addresses."}, {"network", RPCArg::Type::STR, RPCArg::DefaultHint{"all networks"}, "Return only addresses of the specified network. Can be one of: " + Join(GetNetworkNames(), ", ") + "."}, From e738513a2cb4779ef1d47789db8d1d7eec62e420 Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Tue, 22 Feb 2022 11:19:32 +0100 Subject: [PATCH 5/5] Merge bitcoin/bitcoin#24305: Docs: [policy] Remove outdated confusing comment e50a9be1540c769a99fcdc1f7a109a6bf1c7516b Remove outdated comment on CFeeRate (Murch) Pull request description: This comment described how the constructor of CFeeRate was previously indirectly used to parse fee rate arguments from RPCs. The command line input was actually in sat/vB but due to the use of AmountFromValue() it got converted to BTC/vB which then got rectified in the constructor by creating a CFeeRate from that given value and COIN as the transaction size. Since this usage pattern was removed from the codebase some months ago, the comment is now obsolete. ACKs for top commit: michaelfolkson: ACK e50a9be1540c769a99fcdc1f7a109a6bf1c7516b jonatack: ACK e50a9be1540c769a99fcdc1f7a109a6bf1c7516b Tree-SHA512: f17bf0baeeca85a5c7883edadd407da845f6e3af1c949e93116bd67c02e601682a5f7f1ab2497172472e3acf1c4e3c234b01161a77e7d7f028e3551da34777f0 --- src/policy/feerate.h | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/policy/feerate.h b/src/policy/feerate.h index df700dfed5..e52d29454f 100644 --- a/src/policy/feerate.h +++ b/src/policy/feerate.h @@ -24,34 +24,38 @@ enum class FeeEstimateMode { }; /** - * Fee rate in satoshis per kilobyte: CAmount / kB + * Fee rate in satoshis per kilovirtualbyte: CAmount / kvB */ class CFeeRate { private: - CAmount nSatoshisPerK; // unit is satoshis-per-1,000-bytes + /** Fee rate in sat/kvB (satoshis per 1000 virtualbytes) */ + CAmount nSatoshisPerK; public: - /** Fee rate of 0 satoshis per kB */ + /** Fee rate of 0 satoshis per kvB */ CFeeRate() : nSatoshisPerK(0) { } template explicit CFeeRate(const I _nSatoshisPerK): nSatoshisPerK(_nSatoshisPerK) { // We've previously had bugs creep in from silent double->int conversion... static_assert(std::is_integral::value, "CFeeRate should be used without floats"); } - /** Constructor for a fee rate in satoshis per kB (duff/kB). + + /** + * Construct a fee rate from a fee in satoshis and a vsize in vB. * - * Passing a num_bytes value of COIN (1e8) returns a fee rate in satoshis per B (sat/B), - * e.g. (nFeePaid * 1e8 / 1e3) == (nFeePaid / 1e5), - * where 1e5 is the ratio to convert from DASH/kB to sat/B. + * param@[in] nFeePaid The fee paid by a transaction, in satoshis + * param@[in] num_bytes The vsize of a transaction, in vbytes. */ CFeeRate(const CAmount& nFeePaid, uint32_t num_bytes); + /** - * Return the fee in satoshis for the given size in bytes. + * Return the fee in satoshis for the given size in vbytes. */ CAmount GetFee(uint32_t num_bytes) const; + /** - * Return the fee in satoshis for a size of 1000 bytes + * Return the fee in satoshis for a vsize of 1000 vbytes */ CAmount GetFeePerK() const { return nSatoshisPerK; } friend bool operator<(const CFeeRate& a, const CFeeRate& b) { return a.nSatoshisPerK < b.nSatoshisPerK; }