rpc: Register calls where they are defined#7766
Conversation
e1cf847 to
a20fca9
Compare
|
Nice! |
|
Concept ACK. Would it make sense to get rid of the duplicate code in |
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. |
|
IMO we should keep the array loop as it is (and not refactor with some hard-to-understand macro-like optimization). |
|
Could make it two lines, even, without losing any clarity: (will update the one in rpcwallet as well) |
|
Concept ACK |
|
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? |
Awesome idea, will do that. |
|
utACK 3be52e1 |
1 similar comment
|
utACK 3be52e1 |
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 bitcoin#7307 for the non-wallet.
|
Squashed a20fca9 0b18725 dcb0a76 3be52e1 into fb8a8cf |
3be52e1 to
fb8a8cf
Compare
fb8a8cf rpc: Register calls where they are defined (Wladimir J. van der Laan)
fb8a8cf rpc: Register calls where they are defined (Wladimir J. van der Laan)
RPC code refactor Cherry-picked from the following upstream PRs: - bitcoin/bitcoin#7307 - bitcoin/bitcoin#7348 - bitcoin/bitcoin#7766
RPC code refactor Cherry-picked from the following upstream PRs: - bitcoin/bitcoin#7307 - bitcoin/bitcoin#7348 - bitcoin/bitcoin#7766
RPC code refactor Cherry-picked from the following upstream PRs: - bitcoin/bitcoin#7307 - bitcoin/bitcoin#7348 - bitcoin/bitcoin#7766
9f4868a [move] move listunspent to wallet/rpcwallet.cpp (furszy) e85e4f1 [RPC] Move RPC dispatch table registration to rpcwallet code (furszy) c0bc348 [RPC] push down reqWallet [first step] (furszy) cdb80a6 [RPC] Remove not used threadsafe in CRPCCommand (furszy) Pull request description: Initial work over the RPC dispatch table registration update. Includes the following changes: 1) Remove the unused threadSafe member from every CPRCCommand. (bitcoin#5711 , second commit) 2) Remove reqWallet from every CPRCCommand (bitcoin#5992 , second commit partially). 3) Move most of the wallet RPC commands registration to the rpcwallet file (bitcoin#7307 without the `EnsureWalletIsAvailable` on every RPC call --> mainly because the wallet RPC commands will only be registered if the wallet is available). to do: Move the remaining commands that were not moved from server to rpcwallet. ---------- Next step would be bitcoin#7766 (If anyone want to tackle it, feel more than welcome to tackle it). ACKs for top commit: Fuzzbawls: ACK 9f4868a random-zebra: All good. ACK 9f4868a and merging... Tree-SHA512: cd83cdc2de81efb5cb84d39753a160b19d8ca2967a1b303d85c3279559b478352c5a4316942c7a654e9c667b5a8f5bfa18020c1b6c9e78f4c408028840d0fc86
903b618 Mark findserial and getserials as zerocoin commands (Fuzzbawls) 83dfeaf Refactor: Split up the "pivx" RPC command category (Fuzzbawls) 577414b Refactor: Hide testing-only RPC commands (Fuzzbawls) a876068 Refactor: Move getstakingstatus to rpcwallet.cpp (Fuzzbawls) d25ab83 Refactor: Extract zpiv RPC commands out of rpcwallet (Fuzzbawls) 94eb34b [RPC] Register calls where they are defined (Fuzzbawls) Pull request description: Revives/replaces #1720, backporting bitcoin#7766. 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. - Move zPIV RPC commands to their own file - Move `getstakingstatus` to the more appropriate `rpcwallet.cpp` - Hide commands intended for testing environments only - Split up the ambiguous "pivx" command category ACKs for top commit: furszy: looking good, travis is still running but utACK 903b618. random-zebra: utACK 903b618 and merging... Tree-SHA512: 84f3340efb6081501277883d3ca10f0c9aff8dbe68859a05bd082471b9a311e834670ab6e773a04e7ecfa665d75f3632e9f66062e65b5a5440b098fef7da2016
Split out registration of methods to every module, apart from 'help' and 'stop' which are implemented in rpcserver.cpp itself.
rpc/server.hby getting rid of the huge cluttered list of function definitions.Continues #7307 for the non-wallet.