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

feat(rpc): add getrawtransaction #3908

Merged
merged 8 commits into from
Mar 24, 2022
Merged

feat(rpc): add getrawtransaction #3908

merged 8 commits into from
Mar 24, 2022

Conversation

conradoplg
Copy link
Collaborator

Motivation

We need the getrawtransaction RPC in order to support lightwalletd.

Specifications

Designs

Solution

  • Change transaction-fetching functions to also return the block height they're in (this will likely be refactored in the upcoming database changes)
  • Add getrawtransaction

Based on #3907

Closes #3145

Review

It's mostly complete, it's a draft just because I want to add more tests. But I'd welcome a initial review on the implementation.

Reviewer Checklist

  • Code implements Specs and Designs
  • Tests for Expected Behaviour
  • Tests for Errors

Follow Up Work

Copy link
Contributor

@oxarbitrage oxarbitrage left a comment

Choose a reason for hiding this comment

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

I didnt checked eveything yet but leaving some feedback. All minor stuff.

zebra-rpc/src/methods.rs Outdated Show resolved Hide resolved
zebra-rpc/src/methods.rs Outdated Show resolved Hide resolved
zebra-rpc/src/methods.rs Outdated Show resolved Hide resolved
zebra-rpc/src/methods.rs Outdated Show resolved Hide resolved
zebra-rpc/src/methods.rs Outdated Show resolved Hide resolved
Base automatically changed from mempool-txs-by-mined-id to main March 18, 2022 23:00
zebra-rpc/src/methods.rs Outdated Show resolved Hide resolved
@teor2345 teor2345 added P-Medium ⚡ lightwalletd any work associated with lightwalletd labels Mar 21, 2022
Copy link
Contributor

@teor2345 teor2345 left a comment

Choose a reason for hiding this comment

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

This is completely optional, but I prefer try_into over as, because it catches bugs earlier.

zebra-rpc/src/methods.rs Outdated Show resolved Hide resolved
Copy link
Collaborator Author

@conradoplg conradoplg left a comment

Choose a reason for hiding this comment

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

Thanks for the comments! I've rebased this and addressed them, but I'm still working on tests

zebra-rpc/src/methods.rs Outdated Show resolved Hide resolved
zebra-rpc/src/methods.rs Outdated Show resolved Hide resolved
zebra-rpc/src/methods.rs Outdated Show resolved Hide resolved
zebra-rpc/src/methods.rs Outdated Show resolved Hide resolved
zebra-rpc/src/methods.rs Outdated Show resolved Hide resolved
zebra-rpc/src/methods.rs Show resolved Hide resolved
zebra-rpc/src/methods.rs Show resolved Hide resolved
@conradoplg conradoplg marked this pull request as ready for review March 22, 2022 19:08
@conradoplg conradoplg requested a review from a team as a code owner March 22, 2022 19:08
@conradoplg conradoplg requested review from dconnolly and removed request for a team March 22, 2022 19:08
@conradoplg
Copy link
Collaborator Author

conradoplg commented Mar 22, 2022

This is now ready for final review.

I couldn't come up with new tests other than a couple of proptests for failure cases in 1c3c081, and integration tests seem to require cached state (I thought of spinning both serves and getting a tx from e.g. the second block, but that seems redundant with the cached state test). I also tested manually with curl, e.g.

curl -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"getrawtransaction","params":["30391bc7873e593e4eb99b373a184666995e0cbc6e303d0aa79e8221941fb3eb",1],"id":123}' 127.0.0.1:28232

Copy link
Contributor

@teor2345 teor2345 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 to me, I'm happy for @oxarbitrage to resolve the discussions we both commented on.

Copy link
Contributor

@oxarbitrage oxarbitrage 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.

mergify bot added a commit that referenced this pull request Mar 23, 2022
@teor2345
Copy link
Contributor

@Mergifyio update

@mergify
Copy link
Contributor

mergify bot commented Mar 24, 2022

update

✅ Branch has been successfully updated

@teor2345 teor2345 removed the request for review from dconnolly March 24, 2022 03:29
mergify bot added a commit that referenced this pull request Mar 24, 2022
@mergify mergify bot merged commit e7c0a78 into main Mar 24, 2022
@mergify mergify bot deleted the getrawtransaction branch March 24, 2022 09:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lightwalletd any work associated with lightwalletd
Projects
None yet
Development

Successfully merging this pull request may close these issues.

getrawtransaction JSON-RPC method
3 participants