Post
Topic
Board Development & Technical Discussion
Merits 2 from 1 user
Topic OP
New RPC- Paramaters are not parsed correctly
by
liorko87
on 31/05/2021, 08:22:32 UTC
⭐ Merited by NotATether (2)
I wrote a new RPC and my parameters are not parsed correctly.
This is the definition of the RPCHelpMan:

Code:
return RPCHelpMan{"mycustomrpc",
                "\nchange definitions(before the RPC call returns)\n",
                {
                    {"Param1", RPCArg::Type::NUM, RPCArg::Optional::NO, ""},
                    {"Param2", RPCArg::Type::STR, RPCArg::Optional::NO, ""},
                    {"Param3", RPCArg::Type::STR, RPCArg::Optional::NO, ""},
                    {"Param4", RPCArg::Type::NUM, /* default */ ToString(1000), "How many iterations to try."}
                },
                RPCResult{
                    RPCResult::Type::ARR, "", "",
                    {
                        {RPCResult::Type::STR_HEX, "", "param"},
                    }},
                RPCExamples{
            "\nChange definitions to bitcoin core\n"
            + HelpExampleCli("generatetoaddresswithminer", "param1 \"param2\" \"param3\" ")
                },
        [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue

When I'm running this command from my CLI, I got this error:

Code:
error code: -1
error message:
JSON value is not an integer as expected

Can someone tell me what's wrong in the function definition?