Skip to content

Commit

Permalink
trivial: add missing rpc help messages, remove segwit references, das…
Browse files Browse the repository at this point in the history
…hify help text, undashify code comments (#5852)

## Issue being fixed or feature implemented
This pull request is a follow-up to
[some](#5834 (comment))
[feedback](#5834 (comment))
received on [dash#5834](#5834) as
the patterns highlighted were present in different parts of the codebase
and hence not corrected within the PR itself but addressed separately.

This is that separate PR 🙂 (with some additional cleanup of my own)

## What was done?
* This pull request will remain a draft until
[dash#5834](#5834) as it will
introduce more changes that will need to be corrected in this PR.
* Code introduced that is unique to Dash Core (CoinJoin, InstantSend,
etc.) has been excluded from un-Dashification as the purpose of it is to
reduce backport conflicts, which don't apply in those cases.
* `CWallet::CreateTransaction` and the `CreateTransactionTest` fixture
have been excluded as the former originates from
[dash#3668](#3668) and the latter
from [dash#3667](#3667) and are
distinct enough to be unique to Dash Core.
* There are certain Dashifications and SegWit-removals that prove
frustrating as it would break compatibility with programs that rely on
the naming of certain keys
* `getrawmempool`, `getmempoolancestors`, `getmempooldescendants` and
`getmempoolentry` return `vsize` which is currently an alias of `size`.
I have been advised to retain `vsize` in lieu of potential future
developments. (this was originally remedied in
219a1d0 but has since been dropped)
* `getaddressmempool`, `getaddressutxos` and `getaddressdeltas` all
return a value with the key `satoshis`. This is frustrating to rename to
`duffs` for compatibility reasons.
* `decodepsbt` returns (if applicable) `non_witness_utxo` which is
frustrating to rename simply to `utxo` for the same reason.
* `analyzepsbt` returns (if applicable) `estimated_vsize` which
frustrating to rename to `estimated_size` for the same reason.

## How Has This Been Tested?

## Breaking Changes
None

## Checklist:
- [x] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have added or updated relevant unit/integration/functional/e2e
tests
- [ ] I have made corresponding changes to the documentation
- [x] I have assigned this pull request to a milestone _(for repository
code-owners and collaborators only)_
  • Loading branch information
kwvg authored Feb 9, 2024
1 parent 8dba655 commit d9c549e
Show file tree
Hide file tree
Showing 12 changed files with 69 additions and 66 deletions.
6 changes: 3 additions & 3 deletions src/policy/policy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@
CAmount GetDustThreshold(const CTxOut& txout, const CFeeRate& dustRelayFeeIn)
{
// "Dust" is defined in terms of dustRelayFee,
// which has units duffs-per-kilobyte.
// which has units satoshis-per-kilobyte.
// If you'd pay more in fees than the value of the output
// to spend something, then we consider it dust.
// A typical spendable txout is 34 bytes big, and will
// need a CTxIn of at least 148 bytes to spend:
// so dust is a spendable txout less than
// 182*dustRelayFee/1000 (in duffs).
// 546 duffs at the default rate of 3000 duff/kB.
// 182*dustRelayFee/1000 (in satoshis).
// 546 satoshis at the default rate of 3000 sat/kB.
if (txout.scriptPubKey.IsUnspendable())
return 0;

Expand Down
23 changes: 13 additions & 10 deletions src/rpc/blockchain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -282,14 +282,14 @@ static UniValue getbestblockhash(const JSONRPCRequest& request)
static UniValue getbestchainlock(const JSONRPCRequest& request)
{
RPCHelpMan{"getbestchainlock",
"\nReturns information about the best chainlock. Throws an error if there is no known chainlock yet.",
"\nReturns information about the best ChainLock. Throws an error if there is no known ChainLock yet.",
{},
RPCResult{
RPCResult::Type::OBJ, "", "",
{
{RPCResult::Type::STR_HEX, "hash", "The block hash hex-encoded"},
{RPCResult::Type::NUM, "height", "The block height or index"},
{RPCResult::Type::STR_HEX, "signature", "The chainlock's BLS signature"},
{RPCResult::Type::STR_HEX, "signature", "The ChainLock's BLS signature"},
{RPCResult::Type::BOOL, "known_block", "True if the block is known by our node"},
}},
RPCExamples{
Expand All @@ -304,7 +304,7 @@ static UniValue getbestchainlock(const JSONRPCRequest& request)
LLMQContext& llmq_ctx = EnsureLLMQContext(node);
llmq::CChainLockSig clsig = llmq_ctx.clhandler->GetBestChainLock();
if (clsig.IsNull()) {
throw JSONRPCError(RPC_INTERNAL_ERROR, "Unable to find any chainlock");
throw JSONRPCError(RPC_INTERNAL_ERROR, "Unable to find any ChainLock");
}
result.pushKV("blockhash", clsig.getBlockHash().GetHex());
result.pushKV("height", clsig.getHeight());
Expand Down Expand Up @@ -877,6 +877,7 @@ static UniValue getblockheader(const JSONRPCRequest& request)
{RPCResult::Type::NUM, "nTx", "The number of transactions in the block"},
{RPCResult::Type::STR_HEX, "previousblockhash", /* optional */ true, "The hash of the previous block (if available)"},
{RPCResult::Type::STR_HEX, "nextblockhash", /* optional */ true, "The hash of the next block (if available)"},
{RPCResult::Type::BOOL, "chainlock", "The state of the block ChainLock"},
}},
RPCResult{"for verbose=false",
RPCResult::Type::STR_HEX, "", "A string that is serialized, hex-encoded data for block 'hash'"},
Expand Down Expand Up @@ -935,7 +936,7 @@ static UniValue getblockheaders(const JSONRPCRequest& request)
RPCResult::Type::ARR, "", "",
{{RPCResult::Type::OBJ, "", "",
{
{RPCResult::Type::STR_HEX, "hash", "the block hash (same as provided)"},
{RPCResult::Type::STR_HEX, "hash", "The block hash (same as provided)"},
{RPCResult::Type::NUM, "confirmations", "The number of confirmations, or -1 if the block is not on the main chain"},
{RPCResult::Type::NUM, "height", "The block height or index"},
{RPCResult::Type::NUM, "version", "The block version"},
Expand All @@ -950,6 +951,7 @@ static UniValue getblockheaders(const JSONRPCRequest& request)
{RPCResult::Type::NUM, "nTx", "The number of transactions in the block"},
{RPCResult::Type::STR_HEX, "previousblockhash", /* optional */ true, "The hash of the previous block (if available)"},
{RPCResult::Type::STR_HEX, "nextblockhash", /* optional */ true, "The hash of the next block (if available)"},
{RPCResult::Type::BOOL, "chainlock", "The state of the block ChainLock"},
}},
}},
RPCResult{"for verbose=false",
Expand Down Expand Up @@ -1156,6 +1158,7 @@ static UniValue getblock(const JSONRPCRequest& request)
{RPCResult::Type::NUM, "nTx", "The number of transactions in the block"},
{RPCResult::Type::STR_HEX, "previousblockhash", /* optional */ true, "The hash of the previous block (if available)"},
{RPCResult::Type::STR_HEX, "nextblockhash", /* optional */ true, "The hash of the next block (if available)"},
{RPCResult::Type::BOOL, "chainlock", "The state of the block ChainLock"},
{RPCResult::Type::NUM, "size", "The block size"},
{RPCResult::Type::ARR, "tx", "The transaction ids",
{{RPCResult::Type::STR_HEX, "", "The transaction id"}}},
Expand Down Expand Up @@ -1459,8 +1462,8 @@ static UniValue gettxout(const JSONRPCRequest& request)
{RPCResult::Type::STR_HEX, "hex", ""},
{RPCResult::Type::NUM, "reqSigs", "Number of required signatures"},
{RPCResult::Type::STR_HEX, "type", "The type, eg pubkeyhash"},
{RPCResult::Type::ARR, "addresses", "array of dash addresses",
{{RPCResult::Type::STR, "address", "dash address"}}},
{RPCResult::Type::ARR, "addresses", "Array of Dash addresses",
{{RPCResult::Type::STR, "address", "Dash address"}}},
}},
{RPCResult::Type::BOOL, "coinbase", "Coinbase or not"},
}},
Expand Down Expand Up @@ -1914,7 +1917,7 @@ static UniValue getmempoolinfo(const JSONRPCRequest& request)
{
{RPCResult::Type::BOOL, "loaded", "True if the mempool is fully loaded"},
{RPCResult::Type::NUM, "size", "Current tx count"},
{RPCResult::Type::NUM, "bytes", "Sum of all virtual transaction sizes as defined in BIP 141. Differs from actual serialized size because witness data is discounted"},
{RPCResult::Type::NUM, "bytes", "Sum of all transaction sizes"},
{RPCResult::Type::NUM, "usage", "Total memory usage for the mempool"},
{RPCResult::Type::STR_AMOUNT, "total_fee", "Total fees for the mempool in " + CURRENCY_UNIT + ", ignoring modified fees through prioritizetransaction"},
{RPCResult::Type::NUM, "maxmempool", "Maximum memory usage for the mempool"},
Expand Down Expand Up @@ -2208,7 +2211,7 @@ static UniValue getblockstats(const JSONRPCRequest& request)
RPCResult::Type::OBJ, "", "",
{
{RPCResult::Type::NUM, "avgfee", "Average fee in the block"},
{RPCResult::Type::NUM, "avgfeerate", "Average feerate (in satoshis per virtual byte)"},
{RPCResult::Type::NUM, "avgfeerate", "Average feerate (in duffs per virtual byte)"},
{RPCResult::Type::NUM, "avgtxsize", "Average transaction size"},
{RPCResult::Type::STR_HEX, "blockhash", "The block hash (to check for potential reorgs)"},
{RPCResult::Type::ARR_FIXED, "feerate_percentiles", "Feerates at the 10th, 25th, 50th, 75th, and 90th percentile weight unit (in duffs per byte)",
Expand All @@ -2222,13 +2225,13 @@ static UniValue getblockstats(const JSONRPCRequest& request)
{RPCResult::Type::NUM, "height", "The height of the block"},
{RPCResult::Type::NUM, "ins", "The number of inputs (excluding coinbase)"},
{RPCResult::Type::NUM, "maxfee", "Maximum fee in the block"},
{RPCResult::Type::NUM, "maxfeerate", "Maximum feerate (in satoshis per virtual byte)"},
{RPCResult::Type::NUM, "maxfeerate", "Maximum feerate (in duffs per virtual byte)"},
{RPCResult::Type::NUM, "maxtxsize", "Maximum transaction size"},
{RPCResult::Type::NUM, "medianfee", "Truncated median fee in the block"},
{RPCResult::Type::NUM, "mediantime", "The block median time past"},
{RPCResult::Type::NUM, "mediantxsize", "Truncated median transaction size"},
{RPCResult::Type::NUM, "minfee", "Minimum fee in the block"},
{RPCResult::Type::NUM, "minfeerate", "Minimum feerate (in satoshis per virtual byte)"},
{RPCResult::Type::NUM, "minfeerate", "Minimum feerate (in duffs per virtual byte)"},
{RPCResult::Type::NUM, "mintxsize", "Minimum transaction size"},
{RPCResult::Type::NUM, "outs", "The number of outputs"},
{RPCResult::Type::NUM, "subsidy", "The block subsidy"},
Expand Down
8 changes: 4 additions & 4 deletions src/rpc/evo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ static RPCArg GetRpcArg(const std::string& strParamName)
static const std::map<std::string, RPCArg> mapParamHelp = {
{"collateralAddress",
{"collateralAddress", RPCArg::Type::STR, RPCArg::Optional::NO,
"The dash address to send the collateral to."}
"The Dash address to send the collateral to."}
},
{"collateralHash",
{"collateralHash", RPCArg::Type::STR, RPCArg::Optional::NO,
Expand Down Expand Up @@ -116,17 +116,17 @@ static RPCArg GetRpcArg(const std::string& strParamName)
},
{"ownerAddress",
{"ownerAddress", RPCArg::Type::STR, RPCArg::Optional::NO,
"The dash address to use for payee updates and proposal voting.\n"
"The Dash address to use for payee updates and proposal voting.\n"
"The corresponding private key does not have to be known by your wallet.\n"
"The address must be unused and must differ from the collateralAddress."}
},
{"payoutAddress_register",
{"payoutAddress", RPCArg::Type::STR, RPCArg::Optional::NO,
"The dash address to use for masternode reward payments."}
"The Dash address to use for masternode reward payments."}
},
{"payoutAddress_update",
{"payoutAddress", RPCArg::Type::STR, RPCArg::Optional::NO,
"The dash address to use for masternode reward payments.\n"
"The Dash address to use for masternode reward payments.\n"
"If set to an empty string, the currently active payout address is reused."}
},
{"proTxHash",
Expand Down
6 changes: 3 additions & 3 deletions src/rpc/mining.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -573,20 +573,20 @@ static UniValue getblocktemplate(const JSONRPCRequest& request)
{
{RPCResult::Type::STR_HEX, "data", "transaction data encoded in hexadecimal (byte-for-byte)"},
{RPCResult::Type::STR_HEX, "txid", "transaction id encoded in little-endian hexadecimal"},
{RPCResult::Type::STR_HEX, "hash", "hash encoded in little-endian hexadecimal (including witness data)"},
{RPCResult::Type::STR_HEX, "hash", "hash encoded in little-endian hexadecimal"},
{RPCResult::Type::ARR, "depends", "array of numbers",
{
{RPCResult::Type::NUM, "", "transactions before this one (by 1-based index in 'transactions' list) that must be present in the final block if this one is"},
}},
{RPCResult::Type::NUM, "fee", "difference in value between transaction inputs and outputs (in satoshis); for coinbase transactions, this is a negative Number of the total collected block fees (ie, not including the block subsidy); if key is not present, fee is unknown and clients MUST NOT assume there isn't one"},
{RPCResult::Type::NUM, "fee", "difference in value between transaction inputs and outputs (in duffs); for coinbase transactions, this is a negative Number of the total collected block fees (ie, not including the block subsidy); if key is not present, fee is unknown and clients MUST NOT assume there isn't one"},
{RPCResult::Type::NUM, "sigops", "total number of SigOps, as counted for purposes of block limits; if key is not present, sigop count is unknown and clients MUST NOT assume there aren't any"},
}},
}},
{RPCResult::Type::OBJ_DYN, "coinbaseaux", "data that should be included in the coinbase's scriptSig content",
{
{RPCResult::Type::STR_HEX, "key", "values must be in the coinbase (keys may be ignored)"},
}},
{RPCResult::Type::NUM, "coinbasevalue", "maximum allowable input to coinbase transaction, including the generation award and transaction fees (in satoshis)"},
{RPCResult::Type::NUM, "coinbasevalue", "maximum allowable input to coinbase transaction, including the generation award and transaction fees (in duffs)"},
{RPCResult::Type::STR, "longpollid", "an id to include with a request to longpoll on an update to this template"},
{RPCResult::Type::STR, "target", "The hash target"},
{RPCResult::Type::NUM_TIME, "mintime", "The minimum timestamp appropriate for the next block time, expressed in " + UNIX_EPOCH_TIME},
Expand Down
8 changes: 4 additions & 4 deletions src/rpc/misc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,15 +216,15 @@ static UniValue sporkupdate(const JSONRPCRequest& request)
static UniValue validateaddress(const JSONRPCRequest& request)
{
RPCHelpMan{"validateaddress",
"\nReturn information about the given dash address.\n",
"\nReturn information about the given Dash address.\n",
{
{"address", RPCArg::Type::STR, RPCArg::Optional::NO, "The dash address to validate"},
{"address", RPCArg::Type::STR, RPCArg::Optional::NO, "The Dash address to validate"},
},
RPCResult{
RPCResult::Type::OBJ, "", "",
{
{RPCResult::Type::BOOL, "isvalid", "If the address is valid or not"},
{RPCResult::Type::STR, "address", "The dash address validated"},
{RPCResult::Type::STR, "address", "The Dash address validated"},
{RPCResult::Type::STR_HEX, "scriptPubKey", "The hex-encoded scriptPubKey generated by the address"},
{RPCResult::Type::BOOL, "isscript", "If the key is a script"},
{RPCResult::Type::STR, "error", /* optional */ true, "Error message, if any"},
Expand Down Expand Up @@ -441,7 +441,7 @@ static UniValue verifymessage(const JSONRPCRequest& request)
RPCHelpMan{"verifymessage",
"\nVerify a signed message\n",
{
{"address", RPCArg::Type::STR, RPCArg::Optional::NO, "The dash address to use for the signature."},
{"address", RPCArg::Type::STR, RPCArg::Optional::NO, "The Dash address to use for the signature."},
{"signature", RPCArg::Type::STR, RPCArg::Optional::NO, "The signature provided by the signer in base 64 encoding (see signmessage)."},
{"message", RPCArg::Type::STR, RPCArg::Optional::NO, "The message that was signed."},
},
Expand Down
2 changes: 1 addition & 1 deletion src/rpc/net.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ static UniValue getaddednodeinfo(const JSONRPCRequest& request)
{
{RPCResult::Type::OBJ, "", "",
{
{RPCResult::Type::STR, "address", "The dash server IP and port we're connected to"},
{RPCResult::Type::STR, "address", "The Dash server IP and port we're connected to"},
{RPCResult::Type::STR, "connected", "connection, inbound or outbound"},
}},
}},
Expand Down
Loading

0 comments on commit d9c549e

Please sign in to comment.