-
Notifications
You must be signed in to change notification settings - Fork 37.8k
[RPC] add possibility to extend the JSONRPC URI schemas #6006
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
PS: |
I thought about this long ago. JSON-RPC is really built around a single endpoint through which all information is exchanged. It's essentially a messaging tunnel. This PR changes that model, without apparent need. It did not seem to make sense to add another level like this, when you can easily just add new methods. Convention "mining.$name" or "wallet.$name" can easily suffice, and registered services/plugins may be triggered there. |
4aa0e1e
to
b3fc520
Compare
Recently there was a discussion on IRC about this topic (gmaxwell, sipa, wumpus) http://bitcoinstats.com/irc/bitcoin-dev/logs/2015/04/10#l1428649319 The signaling in this PR hooks in after the JSON Parsing and before the JSONReply. It basically allows bypassing of the raw RPC function and will reuse the whole HTTP/RPC/JSON stack. |
@jgarzik Right, that's also direction I assumed we'd go in for namespacing, but @gmaxwell was arguing against that approach on IRC recently and preferred multiple endpoints. An argument for multiple endpoints is that it makes it easier to transition to separate processes, as client software would support different URIs already. |
Multiple endpoints probably also makes having different authentication easier? |
@sipa Yes. If requests are delegated based on base URI, different endpoints can handle authentication differently. |
f4ca426
to
aeefd63
Compare
Slightly updated:
|
Hmm, I'd rather see a single mechanism, where registered modules register for a particular URI - whether that is the root or not? |
I agree with @sipa. My goal with this PR was to not touch the current wallet implementation. Therefor i only allowed/added the signaling in non root URI spaces, in hope to get more reviews because its behavior is more save and understandable. If – and i tried and will try again – the current wallet will become a module, we should completely modularize the JSON RPC request/response handling. Decoupling the PRC dispatch table would also be a option but looks after no interest:
There is also a commit who would modularize the whole wallet:
|
Fair enough, I understand. If the plan is to merge the two URI interfaces
later, I'm fine with it.
|
I know it somehow looks silly to add changes where there is already the plan (sometime already some code!) to change the changes. But in terms of sane change transitions and reviewability this can make sense. |
I agree, and I've definitely used that strategy myself. But sometimes the
longer plan isn't clear from looking at the initial step.
|
Since consensus seems inclined towards integrating plugin/registration at the URI level, concept ACK |
ec28d33
to
3e392f3
Compare
Rebased and added proper locking for |
3e392f3
to
f6465cb
Compare
ut ACK |
With the current libevent httpd this does no longer work and requires a new concept. Closing for now. |
supersedes #5744
I recognized that this approach of extending RPC calls is more flexible and only needs a few lines of changes.
A new wallet could register for a URI (example:
/wallet
) and response to incoming JSON RPC calls. The signaling overhead should not affect the RPC overall performance.URI distinction could also help if it comes to process separation of core and wallet.
Working "example" will follow soon.