[Discussion Needed] Allow constructing Hashes from underlying byte array#20
Conversation
|
I'd personally vote for removing *::Hash::from_slice and skipping this, but that implies that rust-bitcoin will need to keep its Sha256dHash (at least) type, but I think most of the places rust-bitcoin would need to use that would never care about, eg, converting it to a secp private key, and maybe we can rename the type to something more descriptive given it may literally just be used for Bitcoin object hashes (ie block hash, txid...). |
|
I think with associated constants we can make this more generic now. |
apoelstra
left a comment
There was a problem hiding this comment.
I don't know what I meant by "more generic" above. This is fine.
|
I also think that having a dedicated method should make this reasonably hard to use by accident/incorrectly, unlike |
With #14 merged, there is no longer a direct way to construct Hashes from an underlying byte array. This reintroduces a way to do so. This also allows for a more efficient implementation of
impl<D: Decoder> Decodable<D> for sha256d::Hash.Needs much discussion because of concerns brought up in #10.