input-output-hk / js-chain-libs

chain-libs javascript SDK
Apache License 2.0
18 stars 14 forks source link

Rename from_bytes to calculate #105

Closed SebastienGllmt closed 4 years ago

SebastienGllmt commented 4 years ago

Hash, BlockId and Fragment are all internally the same Rust type (Hash) and they each provide a way of calculating the hash from a byte array.

However, this function was called from_bytes which is very misleading because from_bytes everywhere else in the codebase means to simply interpret the bytes as the type.

To dis-ambiguate, I renamed the from_bytes to calculate and added a new from_bytes function that interprets the bytes as the type as you would expect