Skip to content

Commit

Permalink
Merge dashpay#6435: backport: bitcoin#24281, 24360, 24347, 24376, 243…
Browse files Browse the repository at this point in the history
…70, 24305

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

Pull request description:

  Backports

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

Tree-SHA512: 6a3c0caa11f55e17e52881761b4b3e20edb942daadad5ebb0af711ff23d8ddf7ef9987eb75ec4fc45e7211f7e82e3f00e2f59f3131dba17509d09ae018f8133a
  • Loading branch information
PastaPastaPasta committed Dec 9, 2024
2 parents babafbb + e738513 commit 5329f04
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 21 deletions.
15 changes: 8 additions & 7 deletions src/bitcoin-cli.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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("-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("-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);

Expand Down Expand Up @@ -640,8 +640,9 @@ class NetinfoRequestHandler : public BaseRequestHandler
"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"
Expand Down Expand Up @@ -680,13 +681,13 @@ class NetinfoRequestHandler : public BaseRequestHandler
" 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) +
Expand Down
2 changes: 1 addition & 1 deletion src/bitcoin-wallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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] <command>\n";
strUsage += "\n" + args.GetHelpMessage();
Expand Down
22 changes: 13 additions & 9 deletions src/policy/feerate.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<typename I>
explicit CFeeRate(const I _nSatoshisPerK): nSatoshisPerK(_nSatoshisPerK) {
// 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");
}
/** 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; }
Expand Down
2 changes: 1 addition & 1 deletion src/rpc/blockchain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 3 additions & 1 deletion src/rpc/net.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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(), ", ") + "."},
Expand Down
2 changes: 1 addition & 1 deletion src/validation.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
3 changes: 2 additions & 1 deletion src/wallet/wallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 5329f04

Please sign in to comment.