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
c00000d rpc: Add MaybeArg() and Arg() default helper (MarcoFalke)
Pull request description:
Currently the RPC method implementations have many issues:
* Default RPC argument values (and their optionality state) are duplicated in the documentation and the C++ code, with no checks to prevent them from going out of sync.
* Getting an optional RPC argument is verbose, using a ternary operator, or worse, a multi-line `if`.
Fix all issues by adding default helper that can be called via `self.Arg<int>(0)`. The helper needs a few lines of code in the `src/rpc/util.h` header file. Everything else will be implemented in the cpp file once and if an RPC method needs it.
There is also an `self.MaybeArg<int>(0)` helper that works on any arg to return the argument, the default, or a falsy value.
ACKs for top commit:
ajtowns:
reACK c00000d
stickies-v:
re-ACK c00000d
TheCharlatan:
re-ACK c00000d
Tree-SHA512: e7ddcab3faa319bc53edbdf3f89ce83389d2c4e571d5db42401620ff105e522a4a0669dad08e08cde5fd05c790aec3b806f63261a9100c2778865a489e57381e
0 commit comments