laanwj added the label RPC/REST/ZMQ on Mar 29, 2016
laanwj force-pushed on Mar 29, 2016
laanwj added the label Refactoring on Mar 29, 2016
jonasschnelli
commented at 6:15 PM on March 29, 2016:
contributor
Nice!
Concept ACK.
MarcoFalke
commented at 6:18 PM on March 29, 2016:
member
Concept ACK. Would it make sense to get rid of the duplicate code in void Register*()?
laanwj
commented at 7:10 AM on March 30, 2016:
member
Would it make sense to get rid of the duplicate code in void Register*()?
Maybe. I thought about it, but it's only a simple loop of four lines, sometimes factoring something so simple out to a function makes things harder to understand, not easier.
Another option would be to export a 'descriptor structure' with a name, pointer to the array, and size of the array. E.g. like Linux modules.
But simply having Register* function leaves it up to the module as to how to determine what to register (e.g. there may be optional features enabled on the command line).
jonasschnelli
commented at 9:30 AM on March 30, 2016:
contributor
IMO we should keep the array loop as it is (and not refactor with some hard-to-understand macro-like optimization).
laanwj
commented at 10:07 AM on March 30, 2016:
member
Could make it two lines, even, without losing any clarity:
for (unsigned int vcidx = 0; vcidx < ARRAYLEN(commands); vcidx++)
tableRPC.appendCommand(commands[vcidx].name, &commands[vcidx]);
(will update the one in rpcwallet as well)
CodeShark
commented at 10:51 AM on March 30, 2016:
contributor
Concept ACK
sipa
commented at 11:47 AM on March 30, 2016:
member
Concept ACK, though I wonder if it wouldn't be cleaner to pass a pointer to tableRPC to the registration commands, so the individual RPC implementations don't even need to depend on access to the global?
laanwj
commented at 11:58 AM on March 30, 2016:
member
pass a pointer to tableRPC to the registration commands
Awesome idea, will do that.
sipa
commented at 3:56 PM on March 30, 2016:
member
utACK3be52e1
dcousens
commented at 1:00 AM on March 31, 2016:
contributor
utACK3be52e1
rpc: Register calls where they are defined
Split out methods to every module, apart from 'help' and 'stop' which
are implemented in rpcserver.cpp itself.
- This makes it easier to add or remove RPC commands - no longer everything that includes
rpcserver.h has to be rebuilt when there's a change there.
- Cleans up `rpc/server.h` by getting rid of the huge cluttered list of function definitions.
- Removes most of the bitcoin-specific code from rpcserver.cpp and .h.
Continues #7307 for the non-wallet.
fb8a8cf2e6
laanwj
commented at 8:48 AM on March 31, 2016:
member
Squashed a20fca9 0b18725 dcb0a76 3be52e1 into fb8a8cf
laanwj force-pushed on Mar 31, 2016
laanwj merged this on Mar 31, 2016
laanwj closed this on Mar 31, 2016
laanwj referenced this in commit 16555b658f on Mar 31, 2016
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-20 06:55 UTC