Skip to content

Commit

Permalink
Merge 80e16ca into merged_master (Bitcoin PR #20012)
Browse files Browse the repository at this point in the history
Made some edits to rpc/client.cpp on the advice of test/functional/rpc_help.py
to make the "RPC conversion tables" consistent, but I have no idea what these
tables are or what they're for. I assume, given that nobody has noticed these
inconsistencies ever, that they're fine.
  • Loading branch information
apoelstra committed Jun 19, 2021
2 parents 08af5ab + 80e16ca commit 561bf64
Show file tree
Hide file tree
Showing 16 changed files with 328 additions and 394 deletions.
1 change: 0 additions & 1 deletion ci/lint/06_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ test/lint/git-subtree-check.sh src/univalue
test/lint/git-subtree-check.sh src/leveldb
test/lint/git-subtree-check.sh src/crc32c
test/lint/check-doc.py
test/lint/check-rpc-mappings.py .
test/lint/lint-all.sh

if [ "$CIRRUS_REPO_FULL_NAME" = "bitcoin/bitcoin" ] && [ -n "$CIRRUS_CRON" ]; then
Expand Down
2 changes: 1 addition & 1 deletion src/qt/test/rpcnestedtests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ static RPCHelpMan rpcNestedTest_rpc()
}

static const CRPCCommand vRPCCommands[] = {
{"test", "rpcNestedTest", &rpcNestedTest_rpc, {"arg1", "arg2", "arg3"}},
{"test", &rpcNestedTest_rpc},
};

void RPCNestedTests::rpcNestedTests()
Expand Down
68 changes: 34 additions & 34 deletions src/rpc/blockchain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2746,44 +2746,44 @@ void RegisterBlockchainRPCCommands(CRPCTable &t)
// clang-format off

static const CRPCCommand commands[] =
{ // category name actor (function) argNames
// --------------------- ------------------------ ----------------------- ----------
{ "blockchain", "getblockchaininfo", &getblockchaininfo, {} },
{ "blockchain", "getchaintxstats", &getchaintxstats, {"nblocks", "blockhash"} },
{ "blockchain", "getblockstats", &getblockstats, {"hash_or_height", "stats"} },
{ "blockchain", "getbestblockhash", &getbestblockhash, {} },
{ "blockchain", "getblockcount", &getblockcount, {} },
{ "blockchain", "getblock", &getblock, {"blockhash","verbosity|verbose"} },
{ "blockchain", "getblockhash", &getblockhash, {"height"} },
{ "blockchain", "getblockheader", &getblockheader, {"blockhash","verbose"} },
{ "blockchain", "getchaintips", &getchaintips, {} },
{ "blockchain", "getdifficulty", &getdifficulty, {} },
{ "blockchain", "getmempoolancestors", &getmempoolancestors, {"txid","verbose"} },
{ "blockchain", "getmempooldescendants", &getmempooldescendants, {"txid","verbose"} },
{ "blockchain", "getmempoolentry", &getmempoolentry, {"txid"} },
{ "blockchain", "getmempoolinfo", &getmempoolinfo, {} },
{ "blockchain", "getrawmempool", &getrawmempool, {"verbose", "mempool_sequence"} },
{ "blockchain", "gettxout", &gettxout, {"txid","n","include_mempool"} },
{ "blockchain", "gettxoutsetinfo", &gettxoutsetinfo, {"hash_type"} },
{ "blockchain", "pruneblockchain", &pruneblockchain, {"height"} },
{ "blockchain", "savemempool", &savemempool, {} },
{ "blockchain", "verifychain", &verifychain, {"checklevel","nblocks"} },

{ "blockchain", "preciousblock", &preciousblock, {"blockhash"} },
{ "blockchain", "scantxoutset", &scantxoutset, {"action", "scanobjects"} },
{ "blockchain", "getblockfilter", &getblockfilter, {"blockhash", "filtertype"} },
{ // category actor (function)
// --------------------- ------------------------
{ "blockchain", &getblockchaininfo, },
{ "blockchain", &getchaintxstats, },
{ "blockchain", &getblockstats, },
{ "blockchain", &getbestblockhash, },
{ "blockchain", &getblockcount, },
{ "blockchain", &getblock, },
{ "blockchain", &getblockhash, },
{ "blockchain", &getblockheader, },
{ "blockchain", &getchaintips, },
{ "blockchain", &getdifficulty, },
{ "blockchain", &getmempoolancestors, },
{ "blockchain", &getmempooldescendants, },
{ "blockchain", &getmempoolentry, },
{ "blockchain", &getmempoolinfo, },
{ "blockchain", &getrawmempool, },
{ "blockchain", &gettxout, },
{ "blockchain", &gettxoutsetinfo, },
{ "blockchain", &pruneblockchain, },
{ "blockchain", &savemempool, },
{ "blockchain", &verifychain, },

{ "blockchain", &preciousblock, },
{ "blockchain", &scantxoutset, },
{ "blockchain", &getblockfilter, },

// ELEMENTS:
{ "blockchain", "getsidechaininfo", &getsidechaininfo, {} },
{ "blockchain", &getsidechaininfo, },

/* Not shown in help */
{ "hidden", "invalidateblock", &invalidateblock, {"blockhash"} },
{ "hidden", "reconsiderblock", &reconsiderblock, {"blockhash"} },
{ "hidden", "waitfornewblock", &waitfornewblock, {"timeout"} },
{ "hidden", "waitforblock", &waitforblock, {"blockhash","timeout"} },
{ "hidden", "waitforblockheight", &waitforblockheight, {"height","timeout"} },
{ "hidden", "syncwithvalidationinterfacequeue", &syncwithvalidationinterfacequeue, {} },
{ "hidden", "dumptxoutset", &dumptxoutset, {"path"} },
{ "hidden", &invalidateblock, },
{ "hidden", &reconsiderblock, },
{ "hidden", &waitfornewblock, },
{ "hidden", &waitforblock, },
{ "hidden", &waitforblockheight, },
{ "hidden", &syncwithvalidationinterfacequeue, },
{ "hidden", &dumptxoutset, },
};
// clang-format on
for (const auto& c : commands) {
Expand Down
15 changes: 5 additions & 10 deletions src/rpc/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ static const CRPCConvertParam vRPCConvertParams[] =
{ "stop", 0, "wait" },
//
// ELEMENTS:
{ "calcfastmerkleroot", 0, "leaves" },
{ "combineblocksigs", 1, "signatures" },
{ "sendtomainchain", 1, "amount" },
{ "sendtomainchain", 2, "subtractfeefromamount" },
Expand All @@ -213,12 +214,10 @@ static const CRPCConvertParam vRPCConvertParams[] =
{ "rawblindrawtransaction", 2, "inputamounts" },
{ "rawblindrawtransaction", 3, "inputassets" },
{ "rawblindrawtransaction", 4, "inputassetblinders" },
{ "rawblindrawtransaction", 5, "totalblinder" },
{ "rawblindrawtransaction", 6, "ignoreblindfail" },
{ "blindrawtransaction", 1, "ignoreblindfail" },
{ "blindrawtransaction", 2, "asset_commitments" },
{ "blindrawtransaction", 3, "blind_issuances" },
{ "blindrawtransaction", 4, "totalblinder" },
{ "blindpsbt", 1, "ignoreblindfail" },
{ "destroyamount", 1, "amount" },
{ "destroyamount", 3, "verbose"},
Expand All @@ -227,6 +226,7 @@ static const CRPCConvertParam vRPCConvertParams[] =
{ "sendtoaddress", 10, "ignoreblindfail" },
{ "createrawtransaction", 4, "output_assets" },
{ "createpsbt", 4, "output_assets" },
{ "walletsignpsbt", 2, "imbalance_ok" },

};
// clang-format on
Expand All @@ -250,14 +250,9 @@ class CRPCConvertTable

CRPCConvertTable::CRPCConvertTable()
{
const unsigned int n_elem =
(sizeof(vRPCConvertParams) / sizeof(vRPCConvertParams[0]));

for (unsigned int i = 0; i < n_elem; i++) {
members.insert(std::make_pair(vRPCConvertParams[i].methodName,
vRPCConvertParams[i].paramIdx));
membersByName.insert(std::make_pair(vRPCConvertParams[i].methodName,
vRPCConvertParams[i].paramName));
for (const auto& cp : vRPCConvertParams) {
members.emplace(cp.methodName, cp.paramIdx);
membersByName.emplace(cp.methodName, cp.paramName);
}
}

Expand Down
51 changes: 25 additions & 26 deletions src/rpc/mining.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1737,32 +1737,31 @@ void RegisterMiningRPCCommands(CRPCTable &t)
// clang-format off

static const CRPCCommand commands[] =
{ // category name actor (function) argNames
// --------------------- ------------------------ ----------------------- ----------
{ "mining", "getnetworkhashps", &getnetworkhashps, {"nblocks","height"} },
{ "mining", "getmininginfo", &getmininginfo, {} },
{ "mining", "prioritisetransaction", &prioritisetransaction, {"txid","dummy","fee_delta"} },
{ "mining", "getblocktemplate", &getblocktemplate, {"template_request"} },
{ "generating", "combineblocksigs", &combineblocksigs, {"blockhex","signatures","witnessScript"} },
{ "mining", "submitheader", &submitheader, {"hexdata"} },
{ "generating", "getnewblockhex", &getnewblockhex, {"min_tx_age", "proposed_parameters", "commit_data"} },
{ "generating", "getcompactsketch", &getcompactsketch, {"block_hex"} },
{ "generating", "consumecompactsketch", &consumecompactsketch, {"sketch"} },
{ "generating", "consumegetblocktxn", &consumegetblocktxn, {"full_block", "block_tx_req"} },
{ "generating", "finalizecompactblock", &finalizecompactblock, {"compact_hex","block_transactions","found_transactions"} },
{ "mining", "testproposedblock", &testproposedblock, {"blockhex", "acceptnonstd"} },


{ "mining", "submitblock", &submitblock, {"hexdata","dummy"} },

{ "generating", "generatetoaddress", &generatetoaddress, {"nblocks","address","maxtries"} },
{ "generating", "generatetodescriptor", &generatetodescriptor, {"num_blocks","descriptor","maxtries"} },
{ "generating", "generateblock", &generateblock, {"output","transactions"} },

{ "util", "estimatesmartfee", &estimatesmartfee, {"conf_target", "estimate_mode"} },

{ "hidden", "estimaterawfee", &estimaterawfee, {"conf_target", "threshold"} },
{ "hidden", "generate", &generate, {} },
{ // category actor (function)
// --------------------- ------------------------
{ "mining", &getnetworkhashps, },
{ "mining", &getmininginfo, },
{ "mining", &prioritisetransaction, },
{ "mining", &getblocktemplate, },
{ "generating", &combineblocksigs, },
{ "mining", &submitheader, },
{ "generating", &getnewblockhex, },
{ "generating", &getcompactsketch, },
{ "generating", &consumecompactsketch, },
{ "generating", &consumegetblocktxn, },
{ "generating", &finalizecompactblock, },
{ "mining", &testproposedblock, },

{ "mining", &submitblock, },

{ "generating", &generatetoaddress, },
{ "generating", &generatetodescriptor, },
{ "generating", &generateblock, },

{ "util", &estimatesmartfee, },

{ "hidden", &estimaterawfee, },
{ "hidden", &generate, },
};
// clang-format on
for (const auto& c : commands) {
Expand Down
38 changes: 19 additions & 19 deletions src/rpc/misc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -976,29 +976,29 @@ void RegisterMiscRPCCommands(CRPCTable &t)
// clang-format off

static const CRPCCommand commands[] =
{ // category name actor (function) argNames
{ // category actor (function)
// --------------------- ------------------------ ----------------------- ----------
{ "control", "getmemoryinfo", &getmemoryinfo, {"mode"} },
{ "control", "logging", &logging, {"include", "exclude"}},
{ "util", "validateaddress", &validateaddress, {"address"} },
{ "util", "createmultisig", &createmultisig, {"nrequired","keys","address_type"} },
{ "util", "deriveaddresses", &deriveaddresses, {"descriptor", "range"} },
{ "util", "getdescriptorinfo", &getdescriptorinfo, {"descriptor"} },
{ "util", "verifymessage", &verifymessage, {"address","signature","message"} },
{ "util", "signmessagewithprivkey", &signmessagewithprivkey, {"privkey","message"} },
{ "util", "getindexinfo", &getindexinfo, {"index_name"} },
{ "control", &getmemoryinfo, },
{ "control", &logging, },
{ "util", &validateaddress, },
{ "util", &createmultisig, },
{ "util", &deriveaddresses, },
{ "util", &getdescriptorinfo, },
{ "util", &verifymessage, },
{ "util", &signmessagewithprivkey, },
{ "util", &getindexinfo, },
// ELEMENTS:
{ "util", "getpakinfo", &getpakinfo, {}},
{ "util", "tweakfedpegscript", &tweakfedpegscript, {"claim_script", "fedpegscript"} },
{ "util", "createblindedaddress", &createblindedaddress, {"address", "blinding_key"}},
{ "util", "dumpassetlabels", &dumpassetlabels, {}},
{ "hidden", "calcfastmerkleroot", &calcfastmerkleroot, {"leaves"} },
{ "util", &getpakinfo, },
{ "util", &tweakfedpegscript, },
{ "util", &createblindedaddress, },
{ "util", &dumpassetlabels, },
{ "hidden", &calcfastmerkleroot, },

/* Not shown in help */
{ "hidden", "setmocktime", &setmocktime, {"timestamp"}},
{ "hidden", "mockscheduler", &mockscheduler, {"delta_time"}},
{ "hidden", "echo", &echo, {"arg0","arg1","arg2","arg3","arg4","arg5","arg6","arg7","arg8","arg9"}},
{ "hidden", "echojson", &echojson, {"arg0","arg1","arg2","arg3","arg4","arg5","arg6","arg7","arg8","arg9"}},
{ "hidden", &setmocktime, },
{ "hidden", &mockscheduler, },
{ "hidden", &echo, },
{ "hidden", &echojson, },
};
// clang-format on
for (const auto& c : commands) {
Expand Down
36 changes: 18 additions & 18 deletions src/rpc/net.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -941,24 +941,24 @@ void RegisterNetRPCCommands(CRPCTable &t)
{
// clang-format off
static const CRPCCommand commands[] =
{ // category name actor (function) argNames
// --------------------- ------------------------ ----------------------- ----------
{ "network", "getconnectioncount", &getconnectioncount, {} },
{ "network", "ping", &ping, {} },
{ "network", "getpeerinfo", &getpeerinfo, {} },
{ "network", "addnode", &addnode, {"node","command"} },
{ "network", "disconnectnode", &disconnectnode, {"address", "nodeid"} },
{ "network", "getaddednodeinfo", &getaddednodeinfo, {"node"} },
{ "network", "getnettotals", &getnettotals, {} },
{ "network", "getnetworkinfo", &getnetworkinfo, {} },
{ "network", "setban", &setban, {"subnet", "command", "bantime", "absolute"} },
{ "network", "listbanned", &listbanned, {} },
{ "network", "clearbanned", &clearbanned, {} },
{ "network", "setnetworkactive", &setnetworkactive, {"state"} },
{ "network", "getnodeaddresses", &getnodeaddresses, {"count"} },

{ "hidden", "addconnection", &addconnection, {"address", "connection_type"} },
{ "hidden", "addpeeraddress", &addpeeraddress, {"address", "port"} },
{ // category actor
// --------------------- -----------------------
{ "network", &getconnectioncount, },
{ "network", &ping, },
{ "network", &getpeerinfo, },
{ "network", &addnode, },
{ "network", &disconnectnode, },
{ "network", &getaddednodeinfo, },
{ "network", &getnettotals, },
{ "network", &getnetworkinfo, },
{ "network", &setban, },
{ "network", &listbanned, },
{ "network", &clearbanned, },
{ "network", &setnetworkactive, },
{ "network", &getnodeaddresses, },

{ "hidden", &addconnection, },
{ "hidden", &addpeeraddress, },
};
// clang-format on
for (const auto& c : commands) {
Expand Down
Loading

0 comments on commit 561bf64

Please sign in to comment.