Merge #6435: backport: bitcoin#24281, 24360, 24347, 24376, 24370, 24305

e738513a2c Merge bitcoin/bitcoin#24305: Docs: [policy] Remove outdated confusing comment (MarcoFalke)
d0e0381dfa Merge bitcoin/bitcoin#24370: rpc, cli: describe quality/recency filtering in getnodeaddresses and -addrinfo (MarcoFalke)
21cea475d8 Merge bitcoin/bitcoin#24376: doc: bitcoin-wallet fixes (help output and code comment) (MarcoFalke)
f1c5ab1fcb Merge bitcoin/bitcoin#24347: rpc: Fix implicit-integer-sign-change in verifychain (MarcoFalke)
19e3ee894e Merge bitcoin/bitcoin#24360: doc: improve -netinfo help based on feedback from users and devs (MarcoFalke)

Pull request description:

  Backports

ACKs for top commit:
  UdjinM6:
    utACK e738513a2c
  PastaPastaPasta:
    utACK e738513a2c

Tree-SHA512: 6a3c0caa11f55e17e52881761b4b3e20edb942daadad5ebb0af711ff23d8ddf7ef9987eb75ec4fc45e7211f7e82e3f00e2f59f3131dba17509d09ae018f8133a
This commit is contained in:
pasta 2024-12-09 15:41:53 -06:00
commit 5329f04ac4
No known key found for this signature in database
GPG Key ID: E2F3D7916E722D38
7 changed files with 29 additions and 21 deletions

View File

@ -75,7 +75,7 @@ static void SetupCliArgs(ArgsManager& argsman)
argsman.AddArg("-conf=<file>", strprintf("Specify configuration file. Relative paths will be prefixed by datadir location. (default: %s)", BITCOIN_CONF_FILENAME), ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS); argsman.AddArg("-conf=<file>", 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=<dir>", "Specify data directory", ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS); argsman.AddArg("-datadir=<dir>", "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("-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("-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); 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);
@ -640,8 +640,9 @@ public:
"Suggestion: use with the Linux watch(1) command for a live dashboard; see example below.\n\n" "Suggestion: use with the Linux watch(1) command for a live dashboard; see example below.\n\n"
"Arguments:\n" "Arguments:\n"
+ strprintf("1. level (integer 0-%d, optional) Specify the info level of the peers dashboard (default 0):\n", MAX_DETAIL_LEVEL) + + 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" " 0 - Peer counts for each reachable network as well as for block relay peers\n"
" 1 - Like 0 but with a peers listing (without address or version columns)\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" " 2 - Like 1 but with an address column\n"
" 3 - Like 1 but with a version column\n" " 3 - Like 1 but with a version column\n"
" 4 - Like 1 but with both address and version columns\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" " id Peer index, in increasing order of peer connections since node startup\n"
" address IP address and port of the peer\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" " 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" "* The peer counts table displays the number of peers for each reachable network as well as\n"
" for each, as well as two special outbound columns for block relay peers and manual peers.\n\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" "* The local addresses table lists each local address broadcast by the node, the port, and the score.\n\n"
"Examples:\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" "> 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" "> dash-cli -netinfo 1\n\n"
"Full dashboard\n" "Full dashboard\n"
+ strprintf("> dash-cli -netinfo %d\n\n", MAX_DETAIL_LEVEL) + + strprintf("> dash-cli -netinfo %d\n\n", MAX_DETAIL_LEVEL) +

View File

@ -56,7 +56,7 @@ static bool WalletAppInit(ArgsManager& args, int argc, char* argv[])
strUsage += "\n" strUsage += "\n"
"dash-wallet is an offline tool for creating and interacting with " PACKAGE_NAME " wallet files.\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" "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" "Usage:\n"
" dash-wallet [options] <command>\n"; " dash-wallet [options] <command>\n";
strUsage += "\n" + args.GetHelpMessage(); strUsage += "\n" + args.GetHelpMessage();

View File

@ -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 class CFeeRate
{ {
private: private:
CAmount nSatoshisPerK; // unit is satoshis-per-1,000-bytes /** Fee rate in sat/kvB (satoshis per 1000 virtualbytes) */
CAmount nSatoshisPerK;
public: public:
/** Fee rate of 0 satoshis per kB */ /** Fee rate of 0 satoshis per kvB */
CFeeRate() : nSatoshisPerK(0) { } CFeeRate() : nSatoshisPerK(0) { }
template<typename I> template<typename I>
explicit CFeeRate(const I _nSatoshisPerK): nSatoshisPerK(_nSatoshisPerK) { explicit CFeeRate(const I _nSatoshisPerK): nSatoshisPerK(_nSatoshisPerK) {
// We've previously had bugs creep in from silent double->int conversion... // We've previously had bugs creep in from silent double->int conversion...
static_assert(std::is_integral<I>::value, "CFeeRate should be used without floats"); static_assert(std::is_integral<I>::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), * param@[in] nFeePaid The fee paid by a transaction, in satoshis
* e.g. (nFeePaid * 1e8 / 1e3) == (nFeePaid / 1e5), * param@[in] num_bytes The vsize of a transaction, in vbytes.
* where 1e5 is the ratio to convert from DASH/kB to sat/B.
*/ */
CFeeRate(const CAmount& nFeePaid, uint32_t num_bytes); 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; 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; } CAmount GetFeePerK() const { return nSatoshisPerK; }
friend bool operator<(const CFeeRate& a, const CFeeRate& b) { return a.nSatoshisPerK < b.nSatoshisPerK; } friend bool operator<(const CFeeRate& a, const CFeeRate& b) { return a.nSatoshisPerK < b.nSatoshisPerK; }

View File

@ -1632,7 +1632,7 @@ static RPCHelpMan verifychain()
}, },
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue [&](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 int check_depth{request.params[1].isNull() ? DEFAULT_CHECKBLOCKS : request.params[1].get_int()};
const NodeContext& node = EnsureAnyNodeContext(request.context); const NodeContext& node = EnsureAnyNodeContext(request.context);

View File

@ -922,7 +922,9 @@ static RPCHelpMan setnetworkactive()
static RPCHelpMan getnodeaddresses() static RPCHelpMan getnodeaddresses()
{ {
return 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."}, {"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(), ", ") + "."}, {"network", RPCArg::Type::STR, RPCArg::DefaultHint{"all networks"}, "Return only addresses of the specified network. Can be one of: " + Join(GetNetworkNames(), ", ") + "."},

View File

@ -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. */ /** 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 unsigned int MIN_BLOCKS_TO_KEEP = 288;
static const signed int DEFAULT_CHECKBLOCKS = 6; 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) // 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. // At 2B MiB per block, 288 blocks = 576 MiB.

View File

@ -1019,7 +1019,8 @@ bool CWallet::LoadToWallet(const uint256& hash, const UpdateWalletTxFn& fill_wtx
if (!fill_wtx(wtx, ins.second)) { if (!fill_wtx(wtx, ins.second)) {
return false; 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()) { if (HaveChain()) {
bool active; bool active;
int height; int height;