scripted-diff: rpc: Don't pointlessly capture in RPCMethod lambdas

-BEGIN VERIFY SCRIPT-
sed -i 's/\[[&]\][(]const RPCMethod[&]/[](const RPCMethod\&/' $(git grep -l '\[\&\](const RPCMethod')
-END VERIFY SCRIPT-
This commit is contained in:
Anthony Towns
2026-02-20 21:07:29 +10:00
parent 4e789299af
commit 5a81d73a81
23 changed files with 169 additions and 169 deletions

View File

@@ -125,7 +125,7 @@ static RPCMethod getnetworkhashps()
HelpExampleCli("getnetworkhashps", "")
+ HelpExampleRpc("getnetworkhashps", "")
},
[&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue
[](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue
{
ChainstateManager& chainman = EnsureAnyChainman(request.context);
LOCK(cs_main);
@@ -234,7 +234,7 @@ static RPCMethod generatetodescriptor()
},
RPCExamples{
"\nGenerate 11 blocks to mydesc\n" + HelpExampleCli("generatetodescriptor", "11 \"mydesc\"")},
[&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue
[](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue
{
const auto num_blocks{self.Arg<int>("num_blocks")};
const auto max_tries{self.Arg<uint64_t>("maxtries")};
@@ -256,7 +256,7 @@ static RPCMethod generatetodescriptor()
static RPCMethod generate()
{
return RPCMethod{"generate", "has been replaced by the -generate cli option. Refer to -help for more information.", {}, {}, RPCExamples{""}, [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue {
return RPCMethod{"generate", "has been replaced by the -generate cli option. Refer to -help for more information.", {}, {}, RPCExamples{""}, [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue {
throw JSONRPCError(RPC_METHOD_NOT_FOUND, self.ToString());
}};
}
@@ -281,7 +281,7 @@ static RPCMethod generatetoaddress()
+ "If you are using the " CLIENT_NAME " wallet, you can get a new address to send the newly generated bitcoin to with:\n"
+ HelpExampleCli("getnewaddress", "")
},
[&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue
[](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue
{
const int num_blocks{request.params[0].getInt<int>()};
const uint64_t max_tries{request.params[2].isNull() ? DEFAULT_MAX_TRIES : request.params[2].getInt<int>()};
@@ -329,7 +329,7 @@ static RPCMethod generateblock()
"\nGenerate a block to myaddress, with txs rawtx and mempool_txid\n"
+ HelpExampleCli("generateblock", R"("myaddress" '["rawtx", "mempool_txid"]')")
},
[&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue
[](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue
{
const auto address_or_descriptor = request.params[0].get_str();
CScript coinbase_output_script;
@@ -453,7 +453,7 @@ static RPCMethod getmininginfo()
HelpExampleCli("getmininginfo", "")
+ HelpExampleRpc("getmininginfo", "")
},
[&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue
[](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue
{
NodeContext& node = EnsureAnyNodeContext(request.context);
const CTxMemPool& mempool = EnsureMemPool(node);
@@ -518,7 +518,7 @@ static RPCMethod prioritisetransaction()
HelpExampleCli("prioritisetransaction", "\"txid\" 0.0 10000")
+ HelpExampleRpc("prioritisetransaction", "\"txid\", 0.0, 10000")
},
[&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue
[](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue
{
LOCK(cs_main);
@@ -563,7 +563,7 @@ static RPCMethod getprioritisedtransactions()
HelpExampleCli("getprioritisedtransactions", "")
+ HelpExampleRpc("getprioritisedtransactions", "")
},
[&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue
[](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue
{
NodeContext& node = EnsureAnyNodeContext(request.context);
CTxMemPool& mempool = EnsureMemPool(node);
@@ -704,7 +704,7 @@ static RPCMethod getblocktemplate()
HelpExampleCli("getblocktemplate", "'{\"rules\": [\"segwit\"]}'")
+ HelpExampleRpc("getblocktemplate", "{\"rules\": [\"segwit\"]}")
},
[&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue
[](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue
{
NodeContext& node = EnsureAnyNodeContext(request.context);
ChainstateManager& chainman = EnsureChainman(node);
@@ -1072,7 +1072,7 @@ static RPCMethod submitblock()
HelpExampleCli("submitblock", "\"mydata\"")
+ HelpExampleRpc("submitblock", "\"mydata\"")
},
[&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue
[](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue
{
std::shared_ptr<CBlock> blockptr = std::make_shared<CBlock>();
CBlock& block = *blockptr;
@@ -1120,7 +1120,7 @@ static RPCMethod submitheader()
HelpExampleCli("submitheader", "\"aabbcc\"") +
HelpExampleRpc("submitheader", "\"aabbcc\"")
},
[&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue
[](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue
{
CBlockHeader h;
if (!DecodeHexBlockHeader(h, request.params[0].get_str())) {