-
Notifications
You must be signed in to change notification settings - Fork 573
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
adds hash to response of wallet/postTransaction #3764
Conversation
sendTransaction includes the hash in its responses, but postTransaction does not. a client _could_ hash the output themselves, but this adds an extra step and perhaps an extra dependency for the client.
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.
Simple, convenient, and unifies RPCs a little more. One question about tests, but non-blockin g.
@@ -27,6 +27,7 @@ describe('Route wallet/postTransaction', () => { | |||
|
|||
expect(addSpy).toHaveBeenCalledTimes(0) | |||
expect(response.status).toBe(200) | |||
expect(response.content.hash).toBeDefined() |
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.
Is it worth it to calculate what the hash
should be and check equality, do you think?
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.
It's a little tricky to do this: there's randomness involved in posting transactions, so posting the same raw transaction twice will result in two different hashes 😓
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, true. Forget it, then, imo.
@@ -27,6 +27,7 @@ describe('Route wallet/postTransaction', () => { | |||
|
|||
expect(addSpy).toHaveBeenCalledTimes(0) | |||
expect(response.status).toBe(200) | |||
expect(response.content.hash).toBeDefined() |
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.
expect(response.content.hash).toBeDefined() | |
expect(response.content.hash).toBe(expect.any(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.
I don't think this works in Jest with toBe
. It seems like CI is failing with this.
Co-authored-by: Jason Spafford <[email protected]>
Summary
sendTransaction includes the hash in its responses, but postTransaction does not.
a client could hash the output themselves, but this adds an extra step and perhaps an extra dependency for the client.
Testing Plan
Documentation
Does this change require any updates to the Iron Fish Docs (ex. the RPC API
Reference)? If yes, link a
related documentation pull request for the website.
Breaking Change
Is this a breaking change? If yes, add notes below on why this is breaking and
what additional work is required, if any.