Merge #14008: Preserve a format of RPC command definitions

d9d79576f4 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
commit 838b85e120
No known key found for this signature in database
GPG key ID: 1E4AED62986CD25D
9 changed files with 18 additions and 2 deletions

View file

@ -285,8 +285,8 @@ public:
* Note that lightweight clients may not know anything besides the hash of previous transactions, * Note that lightweight clients may not know anything besides the hash of previous transactions,
* so may not be able to calculate this. * so may not be able to calculate this.
* *
* @param[in] tx transaction for which we are checking input total * @param[in] tx transaction for which we are checking input total
* @return Sum of value of all inputs (scriptSigs) * @return Sum of value of all inputs (scriptSigs)
*/ */
CAmount GetValueIn(const CTransaction& tx) const; CAmount GetValueIn(const CTransaction& tx) const;

View file

@ -2192,6 +2192,7 @@ UniValue scantxoutset(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
// --------------------- ------------------------ ----------------------- ---------- // --------------------- ------------------------ ----------------------- ----------
@ -2227,6 +2228,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

@ -18,6 +18,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.
@ -163,6 +164,7 @@ static const CRPCConvertParam vRPCConvertParams[] =
{ "rescanblockchain", 1, "stop_height"}, { "rescanblockchain", 1, "stop_height"},
{ "createwallet", 1, "disable_private_keys"}, { "createwallet", 1, "disable_private_keys"},
}; };
// clang-format on
class CRPCConvertTable class CRPCConvertTable
{ {

View file

@ -968,6 +968,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
// --------------------- ------------------------ ----------------------- ---------- // --------------------- ------------------------ ----------------------- ----------
@ -986,6 +987,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

@ -439,6 +439,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
// --------------------- ------------------------ ----------------------- ---------- // --------------------- ------------------------ ----------------------- ----------
@ -454,6 +455,7 @@ static const CRPCCommand commands[] =
{ "hidden", "echo", &echo, {"arg0","arg1","arg2","arg3","arg4","arg5","arg6","arg7","arg8","arg9"}}, { "hidden", "echo", &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", "echojson", &echo, {"arg0","arg1","arg2","arg3","arg4","arg5","arg6","arg7","arg8","arg9"}},
}; };
// clang-format on
void RegisterMiscRPCCommands(CRPCTable &t) void RegisterMiscRPCCommands(CRPCTable &t)
{ {

View file

@ -626,6 +626,7 @@ static UniValue setnetworkactive(const JSONRPCRequest& request)
return g_connman->GetNetworkActive(); return g_connman->GetNetworkActive();
} }
// clang-format off
static const CRPCCommand commands[] = static const CRPCCommand commands[] =
{ // category name actor (function) argNames { // category name actor (function) argNames
// --------------------- ------------------------ ----------------------- ---------- // --------------------- ------------------------ ----------------------- ----------
@ -642,6 +643,7 @@ static const CRPCCommand commands[] =
{ "network", "clearbanned", &clearbanned, {} }, { "network", "clearbanned", &clearbanned, {} },
{ "network", "setnetworkactive", &setnetworkactive, {"state"} }, { "network", "setnetworkactive", &setnetworkactive, {"state"} },
}; };
// clang-format on
void RegisterNetRPCCommands(CRPCTable &t) void RegisterNetRPCCommands(CRPCTable &t)
{ {

View file

@ -1695,6 +1695,7 @@ UniValue converttopsbt(const JSONRPCRequest& request)
return EncodeBase64((unsigned char*)ssTx.data(), ssTx.size()); return EncodeBase64((unsigned char*)ssTx.data(), ssTx.size());
} }
// clang-format off
static const CRPCCommand commands[] = static const CRPCCommand commands[] =
{ // category name actor (function) argNames { // category name actor (function) argNames
// --------------------- ------------------------ ----------------------- ---------- // --------------------- ------------------------ ----------------------- ----------
@ -1716,6 +1717,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

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

View file

@ -4065,6 +4065,7 @@ UniValue importprunedfunds(const JSONRPCRequest& request);
UniValue removeprunedfunds(const JSONRPCRequest& request); UniValue removeprunedfunds(const JSONRPCRequest& request);
UniValue importmulti(const JSONRPCRequest& request); UniValue importmulti(const JSONRPCRequest& request);
// clang-format off
static const CRPCCommand commands[] = static const CRPCCommand commands[] =
{ // category name actor (function) argNames { // category name actor (function) argNames
// --------------------- ------------------------ ----------------------- ---------- // --------------------- ------------------------ ----------------------- ----------
@ -4125,6 +4126,7 @@ static const CRPCCommand commands[] =
{ "wallet", "walletpassphrasechange", &walletpassphrasechange, {"oldpassphrase","newpassphrase"} }, { "wallet", "walletpassphrasechange", &walletpassphrasechange, {"oldpassphrase","newpassphrase"} },
{ "wallet", "walletprocesspsbt", &walletprocesspsbt, {"psbt","sign","sighashtype","bip32derivs"} }, { "wallet", "walletprocesspsbt", &walletprocesspsbt, {"psbt","sign","sighashtype","bip32derivs"} },
}; };
// clang-format on
void RegisterWalletRPCCommands(CRPCTable &t) void RegisterWalletRPCCommands(CRPCTable &t)
{ {