You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Summary:
It's easy to come across this message by simply forgetting to add an entry
in `src/rpc/client.cpp` when an argument name matches an existing entry in that table.
This patch clarifies both the intent and reason for the warning, and suggests possible fixes.
Test Plan:
Add this line to `commands` in `src/rpc/avalanche.cpp`:
`{ "avalanche", "addavalanchepeer", addavalanchepeer, {"nodeid"}},`
`arc lint src/rpc/avalance.cpp` will fail with the warning message (note "nodeid" conflicts with disconnectnode's "nodeid")
Add this line to the table in `src/rpc/client.cpp`:
`{"addavalanchepeer", 0, "nodeid"},`
`arc lint src/rpc/avalance.cpp` passes
Example output:
```
>>> Lint for /home/jasonbcox/projects/bitcoin-abc:
Warning (RPC_MAPPING_WARNING) RPC mapping warning
In order to keep a consistent API, arguments of the same name are
expected to either both be string-typed or converted from JSON. But there
was a conversion mismatch: ["'getavalanchekey' has argument 'nodeid' of
type 'string'", "'disconnectnode' has argument 'nodeid' of type 'JSON'"].
Common root causes for this warning: 1) The command and/or argument are
missing from the conversion table in 'src/rpc/client.cpp'. 2) Arguments
of the same name are being converted from JSON for some commands, but not
for others. Consider renaming arguments such that one name is used for
strings and the other for conversions from JSON.
```
Reviewers: #bitcoin_abc, deadalnix
Reviewed By: #bitcoin_abc, deadalnix
Subscribers: deadalnix
Differential Revision: https://reviews.bitcoinabc.org/D5659
0 commit comments