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

rpcserver: Update gettxout params and result. #2517

Merged
merged 4 commits into from Dec 24, 2020

Conversation

rstaudt2
Copy link
Member

This requires #2516.

This updates the gettxout call to add a required tree parameter and remove version from the result. The changes include:

  • Starting the v3 module dev cycle for the rpc/jsonrpc/types.
  • Bumping the RPC API version to 7.0.0.
  • Removing version from the gettxout result.
    • It is being removed since upcoming changes will be modifying utxo entries to no longer store the tx version, and (per my understanding) the tx version is not really needed for anything by callers either.
  • Adding a required tree param to gettxout.
    • Upcoming changes will be modifying utxo entries to be keyed by an outpoint which includes the txhash, index, and tree, which brought up the question of whether we want the server to check both trees in gettxout (as it does today) or require the client to pass the tree.
    • Based on some discussions, the tree should be known to the caller most of the time, and in the case where it is not, gettxout can be called with each tree to check both trees, so we will require the tree param.

Note: If testing with dcrctl, you'll want to add a replace directive to use the updated types module:
go mod edit -replace=github.com/decred/dcrd/rpc/jsonrpc/types/v2=../dcrd/rpc/jsonrpc/types

Upcoming changes constitute breaking public API changes to the
rpc/jsonrpc/types module, therefore, this follows the process for
introducing major API breaks which consists of:

- Bump the major version in the go.mod of the affected module if not
  already done since the last release tag
- Add a replacement to the go.mod in the main module if not already done
  since the last release tag
- Update all imports in the repo to use the new major version as
  necessary
- Make necessary modifications to allow all other modules to use the new
  version in the same commit
- Repeat the process for any other modules the require a new major as a
  result of consuming the new major(s)
This removes version from the gettxout result, since upcoming changes
will be modifying utxo entries to no longer store the tx version.
Copy link
Member

@davecgh davecgh left a comment

Choose a reason for hiding this comment

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

Super well done! I see this properly updates JSON-RPC API documentation and has everything separated into logical commits.

internal/rpcserver/rpcserver.go Outdated Show resolved Hide resolved
This adds a required tree parameter to gettxout, since upcoming changes
will be modifying utxo entries to be keyed by an outpoint which includes
the txhash, index, and tree.

For any case where the tree is unknown it will now be expected that the
caller would have to check both trees by calling gettxout for each tree.
@davecgh davecgh merged commit 2390db9 into decred:master Dec 24, 2020
@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 Dec 24, 2020
@davecgh davecgh added this to the 1.7.0 milestone Dec 24, 2020
@rstaudt2 rstaudt2 deleted the gettxout-updates branch January 15, 2021 12:43
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.

None yet

2 participants