Skip to content
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

multi: Add tx inputs treasurybase RPC support. #2470

Merged
merged 2 commits into from
Nov 24, 2020

Conversation

davecgh
Copy link
Member

@davecgh davecgh commented Nov 22, 2020

This requires #2469.

This adds a new field to the Vin and VinPrevOut fields of json/rpc/types to identify if the input is a treasurybase or not and updates both the marshalling code as well as the relevant rpcserver results accordingly. Since a treasurybase does not have a signature script like a coinbase and stakebase, the new field is a boolean versus a string like the others.

In addition, it updates the rpcserver help to document the new field.

At a high level, this means the verbose output of decoderawtransaction, getblock, getrawtransaction, searchrawtransactions, and websocket transaction accepted notifications will now identify treasurybase inputs.

It also bumps the rpcserver to version 6.2.0 to signal support for the new features.

Finally, a separate commit updates the JSON-RPC API documentation for decoderawtransaction, getrawtransaction, and searchrawtransactions to make them match reality and also to add the new treasurybase output.

@davecgh davecgh added the rpc server api change Issues and/or pull requests that involve a new RPC server version or breaking to change to the API. label Nov 22, 2020
@davecgh davecgh added this to the 1.7.0 milestone Nov 22, 2020
@davecgh davecgh force-pushed the rpcserver_add_treasurybase_support branch from c0687ab to b15e118 Compare November 23, 2020 21:04
This adds a new field to the Vin and VinPrevOut fields of json/rpc/types
to identify if the input is a treasurybase or not and updates both the
marshalling code as well as the relevant rpcserver results accordingly.
Since a treasurybase does not have a signature script like a coinbase
and stakebase, the new field is a boolean versus a string like the
others.

In addition, it updates the rpcserver help to document the new field.

At a high level, this means the verbose output of decoderawtransaction,
getblock, getrawtransaction, searchrawtransactions, and websocket
transaction accepted notifications will now identify treasurybase
inputs.

Finally, it bumps the rpcserver to version 6.2.0 to signal support for
the new features.
This updates the JSON-RPC API documentation for decoderawtransaction,
getrawtransaction, and searchrawtransactions to make them match reality
and also to add the new treasurybase output.
Copy link
Member

@chappjc chappjc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just one question for my own understanding.

Comment on lines +1085 to +1086
// NOTE: This check MUST come before the coinbase check because a
// treasurybase will be identified as a coinbase as well.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From what I can tell standalone.IsCoinBaseTx will not identify treasurybase as coinbase if isTreasuryEnabled is accurate because of the treasury-like checks in IsCoinBaseTx (the isTreasurySpendLike closure), but I think it's prudent to check treasurybase first regardless.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will. It won't identify treasury spends as coinbases, but it will identify a treasurybase as a coinbase.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, spends. Thanks

Copy link
Member

@JoeGruffins JoeGruffins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a comment on something preexisting. I uploaded these changes to my master to check out the formatting. While everything looks fine, I'm not sure redirection is working completely as intended. Everything is redirected back to decred/dcrd. For example, if you start at https://github.com/JoeGruffins/dcrd and click on the docs link, it takes you to https://github.com/decred/dcrd/tree/master/docs although I was expecting to go to my repository's docs.

@davecgh
Copy link
Member Author

davecgh commented Nov 24, 2020

@JoeGruffins: You can see the rendered without putting it in your own repo here.

The links from the README are absolute (and really should be so they work to go the primary repo from anywhere).

@davecgh davecgh merged commit 804e47f into decred:master Nov 24, 2020
@davecgh davecgh deleted the rpcserver_add_treasurybase_support branch November 24, 2020 10:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rpc server api change Issues and/or pull requests that involve a new RPC server version or breaking to change to the API.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants