-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BREAKING CHANGE: Write the digest of multihash directly to dest when encoding multihash, since we have known the size of digest. We do not choose to encode &[u8] directly, because it will add extra bytes (the compact length of digest) at the beinging of encoding result. For a valid multihash, the length of digest must equal to `size` field of multihash. Therefore, we can only read raw bytes whose length is equal to `size` when decoding. And the digest of Multihash<U64> is of type [u8; 64], taking Code::Sha2_256 as an example, if the digest is treated as &[u8] when encoding, useless data will be added to the encoding result. Signed-off-by: koushiro <koushiro.cqx@gmail.com>
- Loading branch information
Showing
2 changed files
with
55 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters