[CLI] refactor wallets RPC JSON conversions #7831

pull jonasschnelli wants to merge 1 commits into bitcoin:master from jonasschnelli:2016/04/cli_conversion changing 4 files +75 −54
  1. jonasschnelli commented at 9:33 AM on April 7, 2016: contributor

    Currently, the JSON RPC value conversion for bitcoin-cli has a mixed table (core / wallet) in client.cpp. This PR splits the table into a wallet and non-wallet part.

  2. [CLI] refactor wallets RPC JSON conversions 04d2eb177b
  3. jonasschnelli added the label Refactoring on Apr 7, 2016
  4. jonasschnelli added the label Wallet on Apr 7, 2016
  5. in src/rpc/client.h:None in 04d2eb177b
       7 | @@ -8,6 +8,12 @@
       8 |  
       9 |  #include <univalue.h>
      10 |  
      11 | +struct RPCConvertParam
      12 | +{
      13 | +    char methodName[128]; //!< method whose params want conversion
    


    MarcoFalke commented at 2:41 PM on April 7, 2016:

    Nit: Any particular reason for this?

    You can just keep the std::string, so it is move-only:

    diff --git a/src/rpc/client.cpp b/src/rpc/client.cpp
    index 9d4e788..553c21b 100644
    --- a/src/rpc/client.cpp
    +++ b/src/rpc/client.cpp
    @@ -23,3 +23,3 @@ using namespace std;
    
    -static const struct RPCConvertParam vRPCConvertParams[] =
    +static const CRPCConvertParam vRPCConvertParams[] =
     {
    @@ -79,3 +79,3 @@ CRPCConvertTable::CRPCConvertTable()
         for (unsigned int i = 0; i < ARRAYLEN(vRPCConvertParams); i++) {
    -        members.insert(std::make_pair(std::string(vRPCConvertParams[i].methodName),
    +        members.insert(std::make_pair(vRPCConvertParams[i].methodName,
                                           vRPCConvertParams[i].paramIdx));
    @@ -84,3 +84,3 @@ CRPCConvertTable::CRPCConvertTable()
         for (unsigned int i = 0; i < ARRAYLEN(walletRPCConversions); i++) {
    -        members.insert(std::make_pair(std::string(walletRPCConversions[i].methodName),
    +        members.insert(std::make_pair(walletRPCConversions[i].methodName,
                                           walletRPCConversions[i].paramIdx));
    diff --git a/src/rpc/client.h b/src/rpc/client.h
    index 3140f59..9b707ee 100644
    --- a/src/rpc/client.h
    +++ b/src/rpc/client.h
    @@ -10,6 +10,7 @@
    
    -struct RPCConvertParam
    +class CRPCConvertParam
     {
    -    char methodName[128]; //!< method whose params want conversion
    -    int paramIdx; //!< 0-based idx of param to convert
    +public:
    +    std::string methodName; //!< method whose params want conversion
    +    int paramIdx;           //!< 0-based idx of param to convert
     };
    diff --git a/src/wallet/rpcjsonconversion.h b/src/wallet/rpcjsonconversion.h
    index cf5d919..d6c331d 100644
    --- a/src/wallet/rpcjsonconversion.h
    +++ b/src/wallet/rpcjsonconversion.h
    @@ -7,3 +7,5 @@
    
    -static const struct RPCConvertParam walletRPCConversions[] =
    +class CRPCConvertParam;
    +
    +static const CRPCConvertParam walletRPCConversions[] =
     {
    
  6. jonasschnelli commented at 1:53 PM on April 11, 2016: contributor

    Closing. A better solution would be to add a JSON-WSP (serve over http) and allow clients to parse the method/arguments structure. The argument-types/syntax could be additional infos in the CRPCTable (or similar).

  7. jonasschnelli closed this on Apr 11, 2016

  8. MarcoFalke locked this on Sep 8, 2021

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-04-21 15:15 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me