Improving Message struct description#620
Improving Message struct description#620Harshil-Jani wants to merge 1 commit intorust-bitcoin:masterfrom
Conversation
Signed-off-by: Harshil Jani <harshiljani2002@gmail.com>
| /// Message is invalid if | ||
| /// - Message has no content or has a length of zero. | ||
| /// - Message length doesn't match the expected size. | ||
| /// - Non hased message is passed as input. |
There was a problem hiding this comment.
I think this comment is confusing. It's impossible for the length to differ from 32 bytes (which I guess is the "expected size"?) so it's impossible for a message to be invalid in this way.
"Non-hashed message" is also not very precisely defined. It's fine to tell people that this should always be the output of a hash function, and to point them to the [ThirtyTwoByteHash] trait (or whatever it's called) to help them with this, but it's not "invalid" otherwise because it's not well-defined what is the output of a hash function and what is not.
Invalid values are ones that will cause signature signing and verification to fail every time.
There was a problem hiding this comment.
Ah I see. So can I write it like below instead of invalid ?
/// A valid Message is always of 32 Bytes.
Fixes #619