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
Node API v2 #3094
Node API v2 #3094
Conversation
Latest commit introduces a lot of things:
|
api/src/types.rs
Outdated
@@ -266,7 +266,7 @@ pub struct OutputPrintable { | |||
/// Rangeproof hash (as hex string) | |||
pub proof_hash: String, | |||
/// Block height at which the output is found | |||
pub block_height: Option<u64>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why the change here? Just wondering if anything in the wallet will be expecting a ‘null’ here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't remember why I changed the structure from Option<u64>
to u64
. Reverting.
First, all looks very good and well done. I’m glad to see the approach done in the wallet duplicated here cause I think it works quite well. Am okay with this in general, particularly as it runs alongside the v1 api which should give us time to adapt and asjust. There’s the obvious caveat that there may be some further changes required as I haven’t had any chance to test the behaviour of needed wallet functions against the V2 API. Also, definitely missing a trick here by not having doctest functions with sample JSON for each function. This should be easy to do, however it would likely require test framework code that currently only exists in the wallet. We really need to figure our our overall integration strategy, but that’s another discussion. Good job here, and look forward to porting the wallet functions at some point between v3.0.0 and v4.0.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested V1 api and everything looks good there.
Tested grin server config
and confirmed the node will start up with the default config file.
I'm good with this.
👍
Replacement of #3077 does not introduce any backward incompatibility.
RFC here with more details mimblewimble/grin-rfcs#28
TLDR: Introduce a Node JSON-RPC API v2.
TODO:
get_status
get_version
get_block
get_header
chain
methodspool
methodspeers
methodstxhashset
methodsDoctestIn a different PRInternal use of API v2 for GrinIn a different PRBONUS:
ban_peer
/unban_peer
can be port specific.peers.ban_peer
/peers.unban_peer
now returnResult<(),Error>
how to test this PR
Run grin and do POST queries with JSON-RPC body to http://127.0.0.1:3413/v2/owner and http://127.0.0.1:3413/v2/foreign.