-
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
Refactor chain/getTransaction #3841
Refactor chain/getTransaction #3841
Conversation
@@ -39,3 +41,11 @@ export type RpcSpend = { | |||
commitment: string | |||
size: number | |||
} | |||
|
|||
export const RpcSendSchema: yup.ObjectSchema<RpcSpend> = yup |
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.
Can you rename it to RpcSpendSchema
serialized: note.serialize().toString('hex'), | ||
})) | ||
if (!foundTransaction) { | ||
throw new ValidationError( |
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.
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')}`, |
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.
Can you add a unit test on this
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.
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.