Merge #14008: Preserve a format of RPC command definitions

d9d79576f423cd9c5cef4547c7e3648dbb339460 Preserve a format of RPC command definitions (Kostiantyn Stepaniuk)

Pull request description:

  Currently, RPC commands are formatted in a way that it's easy to read
  and that `test/lint/check-rpc-mappings.py` can parse it.

  To void breaking `test/lint/check-rpc-mappings.py` script by running
  `clang-format`, RPC command definitions should be disabled for clang-format.

Tree-SHA512: e17d20ec0e6c4e19410198b55687ebbe6fa01654d214d4578cd16c00b872bf8b0b306594a45523685cd2e9d9280702e00471d9366e87954428e8bbeacd8cad60
This commit is contained in:
Wladimir J. van der Laan 2018-09-10 18:13:11 +02:00 committed by Vijay Das Manikpuri
parent ea750966f9
commit 2833db6e0b
No known key found for this signature in database
GPG Key ID: DB1D81B01DB7C46E
14 changed files with 28 additions and 12 deletions

View File

@ -2570,6 +2570,7 @@ static UniValue getblockfilter(const JSONRPCRequest& request)
return ret; return ret;
} }
// clang-format off
static const CRPCCommand commands[] = static const CRPCCommand commands[] =
{ // category name actor (function) argNames { // category name actor (function) argNames
// --------------------- ------------------------ ----------------------- ---------- // --------------------- ------------------------ ----------------------- ----------
@ -2611,6 +2612,7 @@ static const CRPCCommand commands[] =
{ "hidden", "waitforblockheight", &waitforblockheight, {"height","timeout"} }, { "hidden", "waitforblockheight", &waitforblockheight, {"height","timeout"} },
{ "hidden", "syncwithvalidationinterfacequeue", &syncwithvalidationinterfacequeue, {} }, { "hidden", "syncwithvalidationinterfacequeue", &syncwithvalidationinterfacequeue, {} },
}; };
// clang-format on
void RegisterBlockchainRPCCommands(CRPCTable &t) void RegisterBlockchainRPCCommands(CRPCTable &t)
{ {

View File

@ -19,6 +19,7 @@ public:
std::string paramName; //!< parameter name std::string paramName; //!< parameter name
}; };
// clang-format off
/** /**
* Specify a (method, idx, name) here if the argument is a non-string RPC * Specify a (method, idx, name) here if the argument is a non-string RPC
* argument and needs to be converted from JSON. * argument and needs to be converted from JSON.
@ -192,6 +193,7 @@ static const CRPCConvertParam vRPCConvertParams[] =
{ "getnodeaddresses", 0, "count"}, { "getnodeaddresses", 0, "count"},
{ "stop", 0, "wait" }, { "stop", 0, "wait" },
}; };
// clang-format on
class CRPCConvertTable class CRPCConvertTable
{ {

View File

@ -160,7 +160,7 @@ static UniValue getcoinjoininfo(const JSONRPCRequest& request)
return obj; return obj;
} }
// clang-format off
static const CRPCCommand commands[] = static const CRPCCommand commands[] =
{ // category name actor (function) argNames { // category name actor (function) argNames
// --------------------- ------------------------ --------------------------------- // --------------------- ------------------------ ---------------------------------
@ -170,7 +170,7 @@ static const CRPCCommand commands[] =
{ "dash", "coinjoin", &coinjoin, {} }, { "dash", "coinjoin", &coinjoin, {} },
#endif // ENABLE_WALLET #endif // ENABLE_WALLET
}; };
// clang-format on
void RegisterCoinJoinRPCCommands(CRPCTable &t) void RegisterCoinJoinRPCCommands(CRPCTable &t)
{ {
for (unsigned int vcidx = 0; vcidx < ARRAYLEN(commands); vcidx++) for (unsigned int vcidx = 0; vcidx < ARRAYLEN(commands); vcidx++)

View File

@ -1162,7 +1162,7 @@ static UniValue getsuperblockbudget(const JSONRPCRequest& request)
return ValueFromAmount(CSuperblock::GetPaymentsLimit(nBlockHeight)); return ValueFromAmount(CSuperblock::GetPaymentsLimit(nBlockHeight));
} }
// clang-format off
static const CRPCCommand commands[] = static const CRPCCommand commands[] =
{ // category name actor (function) argNames { // category name actor (function) argNames
// --------------------- ------------------------ ----------------------- ---------- // --------------------- ------------------------ ----------------------- ----------
@ -1173,7 +1173,7 @@ static const CRPCCommand commands[] =
{ "dash", "voteraw", &voteraw, {"tx_hash","tx_index","gov_hash","signal","outcome","time","sig"} }, { "dash", "voteraw", &voteraw, {"tx_hash","tx_index","gov_hash","signal","outcome","time","sig"} },
}; };
// clang-format on
void RegisterGovernanceRPCCommands(CRPCTable &t) void RegisterGovernanceRPCCommands(CRPCTable &t)
{ {
for (unsigned int vcidx = 0; vcidx < ARRAYLEN(commands); vcidx++) for (unsigned int vcidx = 0; vcidx < ARRAYLEN(commands); vcidx++)

View File

@ -694,14 +694,14 @@ static UniValue masternodelist(const JSONRPCRequest& request)
return obj; return obj;
} }
// clang-format off
static const CRPCCommand commands[] = static const CRPCCommand commands[] =
{ // category name actor (function) argNames { // category name actor (function) argNames
// --------------------- ------------------------ ----------------------- ---------- // --------------------- ------------------------ ----------------------- ----------
{ "dash", "masternode", &masternode, {} }, { "dash", "masternode", &masternode, {} },
{ "dash", "masternodelist", &masternodelist, {} }, { "dash", "masternodelist", &masternodelist, {} },
}; };
// clang-format on
void RegisterMasternodeRPCCommands(CRPCTable &t) void RegisterMasternodeRPCCommands(CRPCTable &t)
{ {
for (unsigned int vcidx = 0; vcidx < ARRAYLEN(commands); vcidx++) for (unsigned int vcidx = 0; vcidx < ARRAYLEN(commands); vcidx++)

View File

@ -971,6 +971,7 @@ static UniValue estimaterawfee(const JSONRPCRequest& request)
return result; return result;
} }
// clang-format off
static const CRPCCommand commands[] = static const CRPCCommand commands[] =
{ // category name actor (function) argNames { // category name actor (function) argNames
// --------------------- ------------------------ ----------------------- ---------- // --------------------- ------------------------ ----------------------- ----------
@ -991,6 +992,7 @@ static const CRPCCommand commands[] =
{ "hidden", "estimaterawfee", &estimaterawfee, {"conf_target", "threshold"} }, { "hidden", "estimaterawfee", &estimaterawfee, {"conf_target", "threshold"} },
}; };
// clang-format on
void RegisterMiningRPCCommands(CRPCTable &t) void RegisterMiningRPCCommands(CRPCTable &t)
{ {

View File

@ -1110,6 +1110,7 @@ static UniValue echo(const JSONRPCRequest& request)
return request.params; return request.params;
} }
// clang-format off
static const CRPCCommand commands[] = static const CRPCCommand commands[] =
{ // category name actor (function) argNames { // category name actor (function) argNames
// --------------------- ------------------------ ----------------------- ---------- // --------------------- ------------------------ ----------------------- ----------
@ -1139,6 +1140,7 @@ static const CRPCCommand commands[] =
{ "hidden", "echojson", &echo, {"arg0","arg1","arg2","arg3","arg4","arg5","arg6","arg7","arg8","arg9"}}, { "hidden", "echojson", &echo, {"arg0","arg1","arg2","arg3","arg4","arg5","arg6","arg7","arg8","arg9"}},
{ "hidden", "mnauth", &mnauth, {"nodeId", "proTxHash", "publicKey"}}, { "hidden", "mnauth", &mnauth, {"nodeId", "proTxHash", "publicKey"}},
}; };
// clang-format on
void RegisterMiscRPCCommands(CRPCTable &t) void RegisterMiscRPCCommands(CRPCTable &t)
{ {

View File

@ -756,6 +756,7 @@ static UniValue getnodeaddresses(const JSONRPCRequest& request)
return ret; return ret;
} }
// clang-format off
static const CRPCCommand commands[] = static const CRPCCommand commands[] =
{ // category name actor (function) argNames { // category name actor (function) argNames
// --------------------- ------------------------ ----------------------- ---------- // --------------------- ------------------------ ----------------------- ----------
@ -773,6 +774,7 @@ static const CRPCCommand commands[] =
{ "network", "setnetworkactive", &setnetworkactive, {"state"} }, { "network", "setnetworkactive", &setnetworkactive, {"state"} },
{ "network", "getnodeaddresses", &getnodeaddresses, {"count"} }, { "network", "getnodeaddresses", &getnodeaddresses, {"count"} },
}; };
// clang-format on
void RegisterNetRPCCommands(CRPCTable &t) void RegisterNetRPCCommands(CRPCTable &t)
{ {

View File

@ -1641,6 +1641,7 @@ UniValue converttopsbt(const JSONRPCRequest& request)
return EncodeBase64(ssTx.str()); return EncodeBase64(ssTx.str());
} }
// clang-format off
static const CRPCCommand commands[] = static const CRPCCommand commands[] =
{ // category name actor (function) argNames { // category name actor (function) argNames
// --------------------- ------------------------ ----------------------- ---------- // --------------------- ------------------------ ----------------------- ----------
@ -1662,6 +1663,7 @@ static const CRPCCommand commands[] =
{ "blockchain", "gettxoutproof", &gettxoutproof, {"txids", "blockhash"} }, { "blockchain", "gettxoutproof", &gettxoutproof, {"txids", "blockhash"} },
{ "blockchain", "verifytxoutproof", &verifytxoutproof, {"proof"} }, { "blockchain", "verifytxoutproof", &verifytxoutproof, {"proof"} },
}; };
// clang-format on
void RegisterRawTransactionRPCCommands(CRPCTable &t) void RegisterRawTransactionRPCCommands(CRPCTable &t)
{ {

View File

@ -1287,14 +1287,14 @@ static UniValue _bls(const JSONRPCRequest& request)
bls_help(); bls_help();
} }
} }
// clang-format off
static const CRPCCommand commands[] = static const CRPCCommand commands[] =
{ // category name actor (function) { // category name actor (function)
// --------------------- ------------------------ ----------------------- // --------------------- ------------------------ -----------------------
{ "evo", "bls", &_bls, {} }, { "evo", "bls", &_bls, {} },
{ "evo", "protx", &protx, {} }, { "evo", "protx", &protx, {} },
}; };
// clang-format on
void RegisterEvoRPCCommands(CRPCTable &tableRPC) void RegisterEvoRPCCommands(CRPCTable &tableRPC)
{ {
for (unsigned int vcidx = 0; vcidx < ARRAYLEN(commands); vcidx++) { for (unsigned int vcidx = 0; vcidx < ARRAYLEN(commands); vcidx++) {

View File

@ -753,7 +753,7 @@ static UniValue verifyislock(const JSONRPCRequest& request)
return llmq::quorumSigningManager->VerifyRecoveredSig(llmqType, signHeight, id, txid, sig, 0) || return llmq::quorumSigningManager->VerifyRecoveredSig(llmqType, signHeight, id, txid, sig, 0) ||
llmq::quorumSigningManager->VerifyRecoveredSig(llmqType, signHeight, id, txid, sig, signOffset); llmq::quorumSigningManager->VerifyRecoveredSig(llmqType, signHeight, id, txid, sig, signOffset);
} }
// clang-format off
static const CRPCCommand commands[] = static const CRPCCommand commands[] =
{ // category name actor (function) { // category name actor (function)
// --------------------- ------------------------ ----------------------- // --------------------- ------------------------ -----------------------
@ -761,7 +761,7 @@ static const CRPCCommand commands[] =
{ "evo", "verifychainlock", &verifychainlock, {"blockHash", "signature", "blockHeight"} }, { "evo", "verifychainlock", &verifychainlock, {"blockHash", "signature", "blockHeight"} },
{ "evo", "verifyislock", &verifyislock, {"id", "txid", "signature", "maxHeight"} }, { "evo", "verifyislock", &verifyislock, {"id", "txid", "signature", "maxHeight"} },
}; };
// clang-format on
void RegisterQuorumsRPCCommands(CRPCTable &tableRPC) void RegisterQuorumsRPCCommands(CRPCTable &tableRPC)
{ {
for (unsigned int vcidx = 0; vcidx < ARRAYLEN(commands); vcidx++) for (unsigned int vcidx = 0; vcidx < ARRAYLEN(commands); vcidx++)

View File

@ -330,6 +330,7 @@ static UniValue uptime(const JSONRPCRequest& jsonRequest)
return GetTime() - GetStartupTime(); return GetTime() - GetStartupTime();
} }
// clang-format off
/** /**
* Call Table * Call Table
*/ */
@ -341,6 +342,7 @@ static const CRPCCommand vRPCCommands[] =
{ "control", "stop", &stop, {"wait"} }, { "control", "stop", &stop, {"wait"} },
{ "control", "uptime", &uptime, {} }, { "control", "uptime", &uptime, {} },
}; };
// clang-format on
CRPCTable::CRPCTable() CRPCTable::CRPCTable()
{ {

View File

@ -4102,6 +4102,7 @@ UniValue walletcreatefundedpsbt(const JSONRPCRequest& request)
return result; return result;
} }
// clang-format off
static const CRPCCommand commands[] = static const CRPCCommand commands[] =
{ // category name actor (function) argNames { // category name actor (function) argNames
// --------------------- ------------------------ ----------------------- ---------- // --------------------- ------------------------ ----------------------- ----------
@ -4172,6 +4173,7 @@ static const CRPCCommand commands[] =
{ "wallet", "walletprocesspsbt", &walletprocesspsbt, {"psbt","sign","sighashtype","bip32derivs"} }, { "wallet", "walletprocesspsbt", &walletprocesspsbt, {"psbt","sign","sighashtype","bip32derivs"} },
{ "wallet", "walletcreatefundedpsbt", &walletcreatefundedpsbt, {"inputs","outputs","locktime","options","bip32derivs"} }, { "wallet", "walletcreatefundedpsbt", &walletcreatefundedpsbt, {"inputs","outputs","locktime","options","bip32derivs"} },
}; };
// clang-format on
void RegisterWalletRPCCommands(CRPCTable &t) void RegisterWalletRPCCommands(CRPCTable &t)
{ {