rpc: remove deprecated CRPCCommand constructor #18531

pull MarcoFalke wants to merge 2 commits into bitcoin:master from MarcoFalke:2004-rpcMan changing 6 files +20 −51
  1. MarcoFalke commented at 3:58 PM on April 5, 2020: member

    Remove the CRPCCommand arguments, now that they are asserted to be equal and thus redundant

    Future work

    Here or follow up, makes sense to also assert type of returned UniValue?

    Sure, but let's not get ahead of ourselves. I am going to submit any further works as follow-ups, including:

    • Removing all python regex linters on the args, now that RPCMan can be used to generate any output, including the cli.cpp table
    • Auto-formatting and sanity checking the RPCExamples with RPCMan
    • Checking passed-in json in self-check. Removing redundant checks
    • Checking returned json against documentation to avoid regressions or false documentation
    • Compile the RPC documentation at compile-time to ensure it doesn't change at runtime and is completely static

    Bugs found

    • The assert identified issue #18607
    • The changes itself fixed bug #19250
  2. MarcoFalke cross-referenced this on Apr 5, 2020 from issue rpc: Avoid initialization-order-fiasco on static CRPCCommand tables by MarcoFalke
  3. DrahtBot added the label GUI on Apr 5, 2020
  4. DrahtBot added the label Mining on Apr 5, 2020
  5. DrahtBot added the label RPC/REST/ZMQ on Apr 5, 2020
  6. DrahtBot added the label Tests on Apr 5, 2020
  7. DrahtBot added the label Wallet on Apr 5, 2020
  8. MarcoFalke removed the label GUI on Apr 5, 2020
  9. MarcoFalke removed the label Mining on Apr 5, 2020
  10. MarcoFalke removed the label Tests on Apr 5, 2020
  11. MarcoFalke removed the label Wallet on Apr 5, 2020
  12. DrahtBot commented at 7:37 PM on April 5, 2020: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    <!--174a7506f384e20aa4161008e828411d-->

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #17356 (RPC: Internal named params by luke-jr)

    If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

  13. DrahtBot cross-referenced this on Apr 5, 2020 from issue rpc: Remove deprecated migration code by vasild
  14. DrahtBot cross-referenced this on Apr 5, 2020 from issue rpc: Improve documentation and return value of settxfee by fjahr
  15. DrahtBot cross-referenced this on Apr 5, 2020 from issue rpc, cli: add multiwallet balances rpc and use it in -getinfo by jonatack
  16. DrahtBot cross-referenced this on Apr 5, 2020 from issue rpc: fix/add missing RPCExamples for "Util" RPCs by theStack
  17. DrahtBot cross-referenced this on Apr 5, 2020 from issue refactor: consolidate sendmany and sendtoaddress code by Sjors
  18. DrahtBot cross-referenced this on Apr 5, 2020 from issue wallet: Remove calls to Chain::Lock methods by ryanofsky
  19. DrahtBot cross-referenced this on Apr 5, 2020 from issue rpc: Add generateblock to mine a custom set of transactions by andrewtoth
  20. DrahtBot cross-referenced this on Apr 5, 2020 from issue [refactor] Merge getreceivedby tally into GetReceived function by andrewtoth
  21. DrahtBot cross-referenced this on Apr 5, 2020 from issue UI external signer support (e.g. hardware wallet) by Sjors
  22. DrahtBot cross-referenced this on Apr 5, 2020 from issue External signer support - Wallet Box edition by Sjors
  23. DrahtBot cross-referenced this on Apr 5, 2020 from issue Native Descriptor Wallets using DescriptorScriptPubKeyMan by achow101
  24. DrahtBot cross-referenced this on Apr 5, 2020 from issue [rpc] don't automatically append inputs in walletcreatefundedpsbt by Sjors
  25. DrahtBot cross-referenced this on Apr 5, 2020 from issue Log RPC parameters (arguments) if -debug=rpcparams by LarryRuane
  26. DrahtBot cross-referenced this on Apr 5, 2020 from issue Replace -upgradewallet startup option with upgradewallet RPC by achow101
  27. DrahtBot cross-referenced this on Apr 5, 2020 from issue Wallet passive startup by ryanofsky
  28. DrahtBot cross-referenced this on Apr 5, 2020 from issue rpc: Return whether the block was invalidated on invalidateblock by promag
  29. DrahtBot cross-referenced this on Apr 5, 2020 from issue Add address-based index (attempt 4?) by marcinja
  30. DrahtBot cross-referenced this on Apr 5, 2020 from issue RPC: Support addnode onetry without making the connection priviliged by luke-jr
  31. DrahtBot cross-referenced this on Apr 5, 2020 from issue [wallet] [rpc] sendtoaddress/sendmany: Add explicit feerate option by kallewoof
  32. promag commented at 9:01 AM on April 6, 2020: member

    Concept ACK.

    Here or follow up, makes sense to also assert type of returned UniValue?

  33. MarcoFalke force-pushed on Apr 6, 2020
  34. DrahtBot cross-referenced this on Apr 7, 2020 from issue rpc: Make verifychain default values static, not depend on global args by MarcoFalke
  35. MarcoFalke referenced this in commit 1b151e3ffc on Apr 7, 2020
  36. sidhujag referenced this in commit 121b214536 on Apr 8, 2020
  37. DrahtBot added the label Needs rebase on Apr 10, 2020
  38. MarcoFalke force-pushed on Apr 12, 2020
  39. MarcoFalke commented at 1:37 PM on April 12, 2020: member

    Here or follow up, makes sense to also assert type of returned UniValue?

    Sure, but let's not get ahead of ourselves. I am going to submit any further works as follow-ups, including:

    • Removing the CRPCCommand arguments, now that they are asserted to be equal and thus redundant
    • Removing all python regex linters on the args, now that RPCMan can be used to generate any output, including the cli.cpp table
    • Auto-formatting and sanity checking the RPCExamples with RPCMan
    • Checking passed-in json in self-check. Removing redundant checks
    • Checking returned json against documentation to avoid regressions or false documentation
  40. DrahtBot removed the label Needs rebase on Apr 12, 2020
  41. MarcoFalke cross-referenced this on Apr 12, 2020 from issue rpc: Fix named arguments in documentation by MarcoFalke
  42. DrahtBot cross-referenced this on Apr 12, 2020 from issue rpc: replace raw pointers with shared_ptrs by brakmic
  43. DrahtBot cross-referenced this on Apr 13, 2020 from issue rpc: gui: Don't change behavior based on private keys disabled, instead add new buttons/rpcs/menu items by achow101
  44. DrahtBot cross-referenced this on Apr 14, 2020 from issue assumeutxo by jamesob
  45. DrahtBot added the label Needs rebase on Apr 14, 2020
  46. ryanofsky cross-referenced this on Apr 15, 2020 from issue rpc: remove g_rpc_node & g_rpc_chain by brakmic
  47. MarcoFalke referenced this in commit 244daa4821 on Apr 17, 2020
  48. sidhujag referenced this in commit 645c5f7960 on Apr 17, 2020
  49. MarcoFalke force-pushed on Apr 17, 2020
  50. DrahtBot removed the label Needs rebase on Apr 17, 2020
  51. DrahtBot cross-referenced this on Apr 17, 2020 from issue rpc: allow dumptxoutset to dump human-readable data by pierreN
  52. DrahtBot cross-referenced this on Apr 17, 2020 from issue wallet: Add BlockUntilSyncedToCurrentChain to dumpwallet by MarcoFalke
  53. DrahtBot cross-referenced this on Apr 17, 2020 from issue rpc: separate bumpfee's psbt creation function into psbtbumpfee by achow101
  54. DrahtBot cross-referenced this on Apr 17, 2020 from issue test: checks that bitcoin-cli autocomplete is in sync by pierreN
  55. DrahtBot cross-referenced this on Apr 18, 2020 from issue Reverse cs_main, cs_wallet lock order and reduce cs_main locking by ariard
  56. in src/rpc/server.cpp:149 in fa45fbcd65 outdated
     142 | +        [&](const RPCMan& self, const JSONRPCRequest& jsonRequest) -> UniValue
     143 | +{
     144 | +    self.Check(jsonRequest);
     145 | +    if (jsonRequest.fHelp || jsonRequest.params.size() > 1)
     146 | +        throw std::runtime_error(
     147 | +            self.ToString()
    


    pierreN commented at 2:32 PM on April 18, 2020:

    Since you add a call to RPCMan::Check, why then recheck again for fHelp flag/params size? The if statement could be removed, right?

  57. pierreN approved
  58. pierreN commented at 2:53 PM on April 18, 2020: contributor

    Tested ACK fa45fbc

    This may be out of scope for this PR, but something that might bother RPCMan users a bit is to have to call Check every time (as most do now). I think this issue is reflected in the lambda function signature: to do the actual RPC work, why would you need a reference to RPCMan?

    I tried to refactor a bit the changes on top of your PR so that it's easier for users to use RPCMan: https://github.com/pierreN/bitcoin/commit/b1633b0e449177ca5eea382409e3a3af064fde08 (splits the lambda in 2, add a constructor helper to automatically call Check)

    IMHO this makes the class a tad easier to use (this might be personal taste though?) and shaves off ~500 lines. If you think this refactor is a good idea, please do add it to the PR. Or if you think this is too out of scope, I could do a PR later once this one is merged (or we could just let things as is).

  59. DrahtBot added the label Needs rebase on Apr 19, 2020
  60. pierreN cross-referenced this on Apr 24, 2020 from issue contrib: Autogenerate bash completion by MarcoFalke
  61. MarcoFalke commented at 11:25 PM on April 29, 2020: member

    @pierreN Thanks for the review. I do like your suggestion to pass in the checks into RPCMan and execute them there. However, I think this can be done nicely in a follow-up and would bloat this pull a bit too much.

  62. MarcoFalke force-pushed on Apr 30, 2020
  63. DrahtBot cross-referenced this on Apr 30, 2020 from issue wip: Only support shared validation interfaces by promag
  64. DrahtBot cross-referenced this on Apr 30, 2020 from issue miner: Avoid stack-use-after-return in validationinterface by MarcoFalke
  65. DrahtBot removed the label Needs rebase on Apr 30, 2020
  66. DrahtBot cross-referenced this on Apr 30, 2020 from issue Remove g_rpc_node global by ryanofsky
  67. DrahtBot cross-referenced this on Apr 30, 2020 from issue Allow simple multiwallet rpc calls by jonasschnelli
  68. DrahtBot cross-referenced this on Apr 30, 2020 from issue wallet: Avoid translating RPC errors by MarcoFalke
  69. DrahtBot cross-referenced this on Apr 30, 2020 from issue [RPC] Include coinbase transactions in receivedby RPCs by andrewtoth
  70. MarcoFalke closed this on Apr 30, 2020

  71. MarcoFalke reopened this on Apr 30, 2020

  72. MarcoFalke closed this on Apr 30, 2020

  73. MarcoFalke reopened this on Apr 30, 2020

  74. pierreN commented at 4:47 AM on May 1, 2020: contributor

    I do like your suggestion to pass in the checks into RPCMan and execute them there. However, I think this can be done nicely in a follow-up and would bloat this pull a bit too much.

    Thanks, indeed. I'll send a PR once this one is merged then :smiley:

  75. DrahtBot added the label Needs rebase on May 1, 2020
  76. MarcoFalke force-pushed on May 1, 2020
  77. DrahtBot cross-referenced this on May 1, 2020 from issue Use shared pointers only in validation interface by bvbfan
  78. DrahtBot removed the label Needs rebase on May 1, 2020
  79. DrahtBot cross-referenced this on May 4, 2020 from issue rpc: Added ability to remove watch only addresses by benthecarman
  80. DrahtBot added the label Needs rebase on May 4, 2020
  81. MarcoFalke force-pushed on May 4, 2020
  82. DrahtBot removed the label Needs rebase on May 5, 2020
  83. DrahtBot cross-referenced this on May 5, 2020 from issue rpc: prevent circular deps by extracting into separate include by brakmic
  84. DrahtBot cross-referenced this on May 10, 2020 from issue rpc: Add submit option to generateblock by MarcoFalke
  85. DrahtBot cross-referenced this on May 11, 2020 from issue rpcwallet: Replace boost::optional<T>::emplace with simple assignment of T{} by MarcoFalke
  86. DrahtBot added the label Needs rebase on May 14, 2020
  87. MarcoFalke force-pushed on May 14, 2020
  88. DrahtBot removed the label Needs rebase on May 15, 2020
  89. DrahtBot added the label Needs rebase on May 21, 2020
  90. MarcoFalke force-pushed on May 21, 2020
  91. DrahtBot removed the label Needs rebase on May 21, 2020
  92. DrahtBot added the label Needs rebase on May 23, 2020
  93. MarcoFalke force-pushed on May 23, 2020
  94. DrahtBot removed the label Needs rebase on May 23, 2020
  95. DrahtBot cross-referenced this on May 29, 2020 from issue refactor: remove ::vpwallets and related global variables by ryanofsky
  96. DrahtBot cross-referenced this on May 29, 2020 from issue refactor: Combine GetWalletForJSONRPCRequest and EnsureWalletIsAvailable functions by ryanofsky
  97. DrahtBot cross-referenced this on Jun 2, 2020 from issue wallet: add parent_desc to getaddressinfo by achow101
  98. DrahtBot cross-referenced this on Jun 2, 2020 from issue rpc, cli, test: add bitcoin-cli -generate command by jonatack
  99. DrahtBot cross-referenced this on Jun 4, 2020 from issue multiprocess: Add basic spawn and IPC support by ryanofsky
  100. DrahtBot cross-referenced this on Jun 4, 2020 from issue Multiprocess bitcoin by ryanofsky
  101. DrahtBot cross-referenced this on Jun 5, 2020 from issue Add loadwallet and createwallet load_on_startup options by ryanofsky
  102. DrahtBot cross-referenced this on Jun 11, 2020 from issue Replace automatic bans with discouragement filter by sipa
  103. MarcoFalke cross-referenced this on Jun 11, 2020 from issue wallet: Make RPC help compile-time static by MarcoFalke
  104. DrahtBot added the label Needs rebase on Jun 11, 2020
  105. MarcoFalke force-pushed on Jun 12, 2020
  106. MarcoFalke commented at 9:55 PM on June 12, 2020: member

    Rebased to reduce the diff and get rid of the already merged bugfixes.

    Not sure why GitHub is hiding the comments (there are only 8 in total), but for reference this has one Concept ACK and one (stale) tested ACK.

  107. DrahtBot removed the label Needs rebase on Jun 12, 2020
  108. MarcoFalke cross-referenced this on Jun 15, 2020 from issue RPC: Rephrase generatetoaddress help, and use PACKAGE_NAME by luke-jr
  109. DrahtBot cross-referenced this on Jun 17, 2020 from issue [tests] Allow outbound & block-relay-only connections in functional tests. by amitiuttarwar
  110. DrahtBot cross-referenced this on Jun 17, 2020 from issue refactor: Replace RecursiveMutex with Mutex in CTxMemPool by hebasto
  111. DrahtBot cross-referenced this on Jun 21, 2020 from issue Preserve the `LockData` initial state if "potential deadlock detected" exception thrown by hebasto
  112. DrahtBot cross-referenced this on Jun 21, 2020 from issue validation: re-delegate absurd fee checking from mempool to clients by glozow
  113. DrahtBot added the label Needs rebase on Jun 21, 2020
  114. MarcoFalke force-pushed on Jun 21, 2020
  115. DrahtBot removed the label Needs rebase on Jun 21, 2020
  116. jonatack commented at 3:31 PM on June 21, 2020: contributor

    Concept ACK, will review.

    For testing the printed JSON of CAmounts, I propose assert_scale in test_framework/util.py in 741d4b94f4f30ca2d7e4886bc98a9faa8d5cc8c2 used for testing bitcoin balances in #19089 and #19092.

  117. MarcoFalke added the label Refactoring on Jun 21, 2020
  118. DrahtBot cross-referenced this on Jun 22, 2020 from issue doc: Include wallet path to relevant RPC calls by D4nte
  119. DrahtBot cross-referenced this on Jun 25, 2020 from issue Remove the automatic creation and loading of the default wallet by achow101
  120. DrahtBot added the label Needs rebase on Jun 25, 2020
  121. MarcoFalke force-pushed on Jun 26, 2020
  122. MarcoFalke force-pushed on Jun 26, 2020
  123. DrahtBot removed the label Needs rebase on Jun 26, 2020
  124. MarcoFalke cross-referenced this on Jun 26, 2020 from issue rpc: Assert that RPCArg names are equal to CRPCCommand ones (server) by MarcoFalke
  125. DrahtBot cross-referenced this on Jun 27, 2020 from issue The ultimate send RPC by Sjors
  126. DrahtBot cross-referenced this on Jul 4, 2020 from issue rpc: Add options argument to listtransactions, with paginatebypointer options by kristapsk
  127. DrahtBot cross-referenced this on Jul 6, 2020 from issue rpc generate: print useful help and error message by jonatack
  128. DrahtBot added the label Needs rebase on Jul 7, 2020
  129. MarcoFalke referenced this in commit 804ca26629 on Jul 15, 2020
  130. MarcoFalke force-pushed on Jul 15, 2020
  131. DrahtBot removed the label Needs rebase on Jul 15, 2020
  132. MarcoFalke cross-referenced this on Jul 15, 2020 from issue rpc: Assert that RPCArg names are equal to CRPCCommand ones (misc) by MarcoFalke
  133. MarcoFalke force-pushed on Jul 15, 2020
  134. sidhujag referenced this in commit ea73ed0a45 on Jul 16, 2020
  135. DrahtBot cross-referenced this on Jul 16, 2020 from issue Coinstats Index by fjahr
  136. DrahtBot cross-referenced this on Jul 16, 2020 from issue send* RPCs in the wallet returns the "fee reason" by stackman27
  137. DrahtBot cross-referenced this on Jul 16, 2020 from issue rpc: Add mempoolchanges by promag
  138. DrahtBot cross-referenced this on Jul 16, 2020 from issue Prune locks by luke-jr
  139. DrahtBot cross-referenced this on Jul 16, 2020 from issue multiprocess: Add bitcoin-gui -ipcconnect option by ryanofsky
  140. DrahtBot cross-referenced this on Jul 16, 2020 from issue multiprocess: Add bitcoin-wallet -ipcconnect option by ryanofsky
  141. DrahtBot cross-referenced this on Jul 16, 2020 from issue Replace boost::filesystem with std::filesystem by kiminuo
  142. DrahtBot cross-referenced this on Jul 16, 2020 from issue RPC: Add getrpcwhitelist method by luke-jr
  143. DrahtBot cross-referenced this on Jul 16, 2020 from issue Allow fundrawtransaction and walletcreatefundedpsbt to take external inputs by achow101
  144. DrahtBot cross-referenced this on Jul 18, 2020 from issue refactor: Add ParseBool to rpc/util by fjahr
  145. DrahtBot cross-referenced this on Jul 19, 2020 from issue rpc: Add getindexinfo RPC by fjahr
  146. DrahtBot cross-referenced this on Jul 20, 2020 from issue Remove mempool global by MarcoFalke
  147. DrahtBot cross-referenced this on Jul 20, 2020 from issue rpc: deduplicate WriteHDKeypath() used in decodepsbt by theStack
  148. DrahtBot added the label Needs rebase on Jul 21, 2020
  149. MarcoFalke referenced this in commit 31760bb7c9 on Aug 14, 2020
  150. MarcoFalke force-pushed on Aug 14, 2020
  151. DrahtBot removed the label Needs rebase on Aug 14, 2020
  152. MarcoFalke cross-referenced this on Aug 14, 2020 from issue rpc: Assert that RPCArg names are equal to CRPCCommand ones (mining,zmq,rpcdump) by MarcoFalke
  153. DrahtBot added the label Needs rebase on Aug 14, 2020
  154. MarcoFalke force-pushed on Aug 14, 2020
  155. DrahtBot removed the label Needs rebase on Aug 14, 2020
  156. DrahtBot added the label Needs rebase on Aug 15, 2020
  157. sidhujag referenced this in commit b761dae549 on Aug 16, 2020
  158. sidhujag referenced this in commit 010a3815db on Aug 16, 2020
  159. in src/rpc/blockchain.cpp:2467 in b224f98033 outdated
    2434 | @@ -2435,39 +2435,39 @@ void RegisterBlockchainRPCCommands(CRPCTable &t)
    2435 |  static const CRPCCommand commands[] =
    2436 |  { //  category              name                      actor (function)         argNames
    


    fjahr commented at 3:38 PM on August 30, 2020:

    Missed fixing the headline here.

  160. fjahr commented at 3:45 PM on August 30, 2020: contributor

    Concept ACK

    Will test when this is rebased and checks pass. Please re-check the commit messages, 97a419abaf673d072e3c5b23af078e403d1c5dc4 and 0bd51da9ecdc0c5f3834f8824d260f6f535ded92 seem to be outdated.

  161. MarcoFalke referenced this in commit 89a8299a14 on Aug 31, 2020
  162. MarcoFalke force-pushed on Aug 31, 2020
  163. MarcoFalke cross-referenced this on Aug 31, 2020 from issue Assert that RPCArg names are equal to CRPCCommand ones (blockchain,rawtransaction) by MarcoFalke
  164. DrahtBot removed the label Needs rebase on Aug 31, 2020
  165. MarcoFalke force-pushed on Aug 31, 2020
  166. DrahtBot cross-referenced this on Aug 31, 2020 from issue validation: UTXO snapshot activation by jamesob
  167. DrahtBot cross-referenced this on Aug 31, 2020 from issue rpc: Add dumpcoinstats by fjahr
  168. DrahtBot cross-referenced this on Aug 31, 2020 from issue net: Replace enum CConnMan::NumConnections with enum class ConnectionDirection by luke-jr
  169. DrahtBot cross-referenced this on Aug 31, 2020 from issue wallet, gui: Reload previously loaded wallets on startup by achow101
  170. DrahtBot cross-referenced this on Aug 31, 2020 from issue RPC: Internal named params by luke-jr
  171. DrahtBot cross-referenced this on Aug 31, 2020 from issue Allow whitelisting outgoing connections by luke-jr
  172. sidhujag referenced this in commit 4c2ef86224 on Aug 31, 2020
  173. DrahtBot cross-referenced this on Sep 1, 2020 from issue wallet: Migrate legacy wallets to descriptor wallets by achow101
  174. DrahtBot cross-referenced this on Sep 1, 2020 from issue ZMQ: Create "sequence" notifier, enabling client-side mempool tracking by instagibbs
  175. DrahtBot added the label Needs rebase on Sep 3, 2020
  176. domob1812 referenced this in commit 68bbfff8f8 on Sep 7, 2020
  177. domob1812 referenced this in commit 198ced101f on Sep 7, 2020
  178. domob1812 referenced this in commit 887e7b450a on Sep 7, 2020
  179. MarcoFalke referenced this in commit d692d192cd on Sep 22, 2020
  180. MarcoFalke force-pushed on Sep 22, 2020
  181. MarcoFalke cross-referenced this on Sep 22, 2020 from issue Assert that RPCArg names are equal to CRPCCommand ones (net, rpcwallet) by MarcoFalke
  182. MarcoFalke force-pushed on Sep 22, 2020
  183. DrahtBot removed the label Needs rebase on Sep 22, 2020
  184. MarcoFalke force-pushed on Sep 22, 2020
  185. MarcoFalke force-pushed on Sep 22, 2020
  186. sidhujag referenced this in commit f769a0d8b6 on Sep 23, 2020
  187. DrahtBot added the label Needs rebase on Sep 23, 2020
  188. MarcoFalke referenced this in commit 5e14fafb31 on Sep 23, 2020
  189. sidhujag referenced this in commit 63306f71f5 on Sep 23, 2020
  190. remove dead rpc code
    Checking for fHelp, or the size of the args, is dead code because:
    * fHelp is always false (src/qt/test/rpcnestedtests.cpp)
    * It is already implicitly called by RPCHelpMan::Check
      (src/rpc/mining.cpp, src/rpc/misc.cpp, src/rpc/net.cpp)
    fa19bb2cd8
  191. remove CRPCCommand constructor that takes rpcfn_type function pointer faaf9c58e4
  192. MarcoFalke force-pushed on Sep 24, 2020
  193. MarcoFalke renamed this:
    rpc: Assert that RPCArg names are equal to CRPCCommand ones
    rpc: remove deprecated CRPCCommand constructor
    on Sep 24, 2020
  194. MarcoFalke commented at 7:04 PM on September 24, 2020: member

    This is ready for review now

  195. DrahtBot removed the label Needs rebase on Sep 24, 2020
  196. MarcoFalke cross-referenced this on Sep 25, 2020 from issue rpc: Remove duplicate name and argNames from CRPCCommand by MarcoFalke
  197. promag commented at 8:42 AM on September 25, 2020: member

    On fa19bb2cd8c575593583138a84e6bb3444d6196d you could rename fHelp so that if this gets rebased we don't miss new cases.

  198. in test/lint/lint-rpc-help.sh:15 in faaf9c58e4
      10 | -
      11 | -EXIT_CODE=0
      12 | -
      13 | -# Assume that all multiline strings passed into a runtime_error are help texts.
      14 | -# This is potentially fragile, but the linter is only temporary and can safely
      15 | -# be removed early 2019.
    


    promag commented at 8:45 AM on September 25, 2020:

    😄

  199. in src/rpc/server.h:88 in faaf9c58e4
      84 | @@ -85,7 +85,6 @@ void RPCUnsetTimerInterface(RPCTimerInterface *iface);
      85 |   */
      86 |  void RPCRunLater(const std::string& name, std::function<void()> func, int64_t nSeconds);
      87 |  
      88 | -typedef UniValue(*rpcfn_type)(const JSONRPCRequest& jsonRequest);
      89 |  typedef RPCHelpMan (*RpcMethodFnType)();
    


    promag commented at 8:50 AM on September 25, 2020:

    I wouldn't mind adding a commit to ditch this definition.


    MarcoFalke commented at 10:07 AM on September 25, 2020:

    The def is also used in #20012

  200. promag commented at 9:15 AM on September 25, 2020: member

    Tested ACK faaf9c58e4aa809019d4ca12747dd47411988e37.

    Verified 1st commit claims.

  201. fjahr commented at 10:06 AM on September 25, 2020: contributor

    tested ACK faaf9c58e4aa809019d4ca12747dd47411988e37

  202. DrahtBot cross-referenced this on Sep 30, 2020 from issue upstream: add and use defaulted getters to UniValue by kallewoof
  203. ryanofsky approved
  204. ryanofsky commented at 1:00 PM on November 19, 2020: contributor

    Code review ACK faaf9c58e4aa809019d4ca12747dd47411988e37. Two obviously good simplifications.

    re: #18531#issue-399144769

    Remove the CRPCCommand arguments, now that they are asserted to be equal and thus redundant

    Future work

    Here or follow up, makes sense to also assert type of returned UniValue?

    Sure, but let's not get ahead of ourselves. I am going to submit any further works as follow-ups, including:

    • Removing all python regex linters on the args, now that RPCMan can be used to generate any output, including the cli.cpp table
    • Auto-formatting and sanity checking the RPCExamples with RPCMan
    • Checking passed-in json in self-check. Removing redundant checks
    • Checking returned json against documentation to avoid regressions or false documentation
    • Compile the RPC documentation at compile-time to ensure it doesn't change at runtime and is completely static

    Bugs found

    • The assert identified issue #18607
    • The changes itself fixed bug #19250

    I don't see this is mentioned in "future work" part of PR description, but it seems like a good followup would be to drop redundant name_in and args_in arguments to the other CRPCCommand constructor:

    https://github.com/MarcoFalke/bitcoin-core/blob/faaf9c58e4aa809019d4ca12747dd47411988e37/src/rpc/server.h#L106-L116

    since these are just checked for equality and discarded anyway. Or maybe that's what the PR was originally intended to do? The code changes are simple, but the PR description is a little hard to follow

  205. MarcoFalke merged this on Nov 19, 2020
  206. MarcoFalke closed this on Nov 19, 2020

  207. MarcoFalke deleted the branch on Nov 19, 2020
  208. MarcoFalke commented at 2:06 PM on November 19, 2020: member

    since these are just checked for equality and discarded anyway. Or maybe that's what the PR was originally intended to do? The code changes are simple, but the PR description is a little hard to follow

    Indeed. Done in #20012

  209. sidhujag referenced this in commit 92bd89791a on Nov 19, 2020
  210. Fabcien referenced this in commit 3d7fdc544a on Jan 3, 2022
  211. Fabcien referenced this in commit e74ec8b0f2 on Jan 3, 2022
  212. Fabcien referenced this in commit 9f54c180f5 on Jan 3, 2022
  213. bitcoin locked this on Feb 15, 2022

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-05-19 06:54 UTC