-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
btcjson: Add getmempoolentry API #905
Conversation
<3 BTW the struct |
Thanks for pointing that out. I'll do that after btcd gets support for the new fields in getrawmempool verbose. |
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.
This PR needs to have several things happen as detailed below. I would prefer each of these points grouped into their own commit within the PR.
- btcjson: Create shared mempoolEntryResult.
Create a new shared result type formempoolEntryResult
and update theGetRawMempoolVerboseResult
to use it (akatype GetRawMempoolVerboseResult mempoolEntryResult
) - btcjson: Add getmempoolentry
Add the command, result, and tests (effectively what this PR already does without touchingrpcserver.go
) - rpcserver: Implement getmempoolentry
Add the bits needed by the RPC server to recognize the command and generate the result, update the rpcserver hlep, and update the JSON-RPC API docs
@@ -333,6 +333,19 @@ func NewGetInfoCmd() *GetInfoCmd { | |||
return &GetInfoCmd{} | |||
} | |||
|
|||
// GetMempoolEntryCmd defines the getmempoolentry JSON-RPC command. | |||
type GetMempoolEntryCmd struct { | |||
TxID string |
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.
TxID string `json:"txid"`
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.
doesn't need it actually. json-rpc request parameters are positional, not keyed in an object.
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.
Ah right, I noticed it was on one of the others (GetHeadersCmd
). Given it's positional though, you're right it isn't needed.
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.
Yep.. I added it to that on accident. We can remove it but it doesn't really matter, it just gets ignored.
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.
After discussing this further in chat, we've decided that while the aforementioned things need to happen in order to ultimately properly serve the getmempoolentry
RPC and provide consistency between that RPC and the existing getrawmempool
RPC, the information needed to populate all of the fields is not currently available, so even though those things will need to ultimately happen, the intention of this PR is effectively just making the data structure available so btcrpcclient
has access to it.
We could certainly just register it as a custom type from btcrpcclient
, but ultimately we're going to want to provide all of these data and implement the getrawmempool
RPC anyways, so it makes sense to go ahead and add it to btcjson
now.
OK
Fixes #908