-
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
ListTransactions API is non-standard #1589
Comments
I do agree that we should have one exported function that has all parameters, including optional parameters, as the corresponding Core RPC command. Small nit on your signature: I think it's okay for the methods func (c *Client) ListTransactionsCountFromIncludeWatchOnly(account string, count, from int, includeWatchOnly bool) ([]btcjson.ListTransactionsResult, err error) The rationale behind the design of the API we have in wallet.go is because there are many combinations of optional parameters, so I wouldn't call them bespoke for that reason. This pattern is replicated consistently throughout func (c *Client) ListTransactions(label string, count *int, skip *int, includeWatchOnly *bool) ([]btcjson.ListTransactionsResult, err error) Then we should also be discussing whether or not we should add something similar to the rest of the methods in |
This is what I see in the bitcoin core 0.19.0 docs:
Regarding the rest of your argument, I think the original reason why multiple methods were introduced over one single generic one, was to avoid requiring the caller to use Thanks for the detailed explanation. I tend to agree with your reasoning, and it's much clearer in my head now. Let's wait for the author of #1368 to update his PR. Or maybe we can cherry-pick the commit in a new PR and sneak in the fix for optional |
Yep, you're right :) must have passed over it in the docs. I don't think it would hurt to cherry-pick, address review comments and make a new PR though. |
The
listtransactions
RPC command accepts 4 optional arguments:label
count
skip
include_watchonly
The way this is implemented in the rpcclient is via the following 4 methods (note: signature is out of date):
ListTransactions(account string)
ListTransactionsCount(account string, count int)
ListTransactionsCountFrom(account string, count, from int)
ListTransactionsCountFromWatchOnly(account string, count, from int, watchOnly bool)
I don't know the rationale behind this design, but it encourages bespoke signatures of publicly exposed methods in the rpcclient, which is a maintenance hazard. Also, imagine if tomorrow there is a new option added to the RPC, we'll need to implement yet another method as per our current approach.
I think we should really follow the standard here and have just one method with the following signature:
The text was updated successfully, but these errors were encountered: