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

Refactor chain/getTransaction #3841

Conversation

danield9tqh
Copy link
Member

Summary

Don't return an empty transaction object if the transaction is not found, instead throw an error. Also added some other small code improvements

Testing Plan

Tested on local RPC

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.

[ ] Yes

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.

[ ] Yes

@danield9tqh danield9tqh requested a review from a team as a code owner April 24, 2023 23:17
@@ -39,3 +41,11 @@ export type RpcSpend = {
commitment: string
size: number
}

export const RpcSendSchema: yup.ObjectSchema<RpcSpend> = yup
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you rename it to RpcSpendSchema

serialized: note.serialize().toString('hex'),
}))
if (!foundTransaction) {
throw new ValidationError(
Copy link
Contributor

Choose a reason for hiding this comment

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

NotFound error fits better than Validation. In general Validation error (INVALID_ARGUMENT) indicates arguments that are problematic regardless of the state of the system (e.g., a malformed file name).

}))
if (!foundTransaction) {
throw new ValidationError(
`Transaction not found on block ${blockHashBuffer.toString('hex')}`,
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add a unit test on this

@danield9tqh danield9tqh merged commit 5927154 into iron-fish:staging Apr 25, 2023
@danield9tqh danield9tqh deleted the daniel/ifl-737-refactor-chaingettransaction branch April 25, 2023 03:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants