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/support pw transfer #1928
Feat/support pw transfer #1928
Conversation
katat
commented
Nov 25, 2020
- support transfer to pw lock
- remove the front end check for code hash since the backend also does the check.
@@ -29,10 +28,6 @@ export const validateSUDTAddress = ({ | |||
} | |||
|
|||
const CODE_HASH_LENGTH = 64 | |||
const codeHashOfAddr = parsed.substr(4, CODE_HASH_LENGTH) | |||
if (codeHash && codeHashOfAddr !== codeHash.slice(2)) { | |||
throw new FieldInvalidException(FIELD_NAME) |
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.
By removing the validation of code hash, the error message for invalid code hash will be shown at the top but not beneath the input field. Is that expected?
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.
Instead of Invalid code hash
, it should throw Invalid anyone-can-pay lock script address
at the top, which would be better renamed as Unsupported anyone-can-pay lock script address
I think it is fine since the error only throws when the code hash is not supported, which is rare in practice. It might not be ideal, but it'd better avoid duplicating this code hash check at both front end and back end.
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.
Got it.
I prefer checking it at front end for user experience and back end for security, but it does attenuate duplication of work to validate it at the back end only.