fix(traverse): Make ToHash trait public outside crate (#186)

This commit is contained in:
Santiago Carmuega 2022-09-11 20:06:09 -03:00 committed by GitHub
parent 13a1c6852b
commit 38262213e8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 9 deletions

View file

@ -1,11 +1,8 @@
use crate::ToHash;
use pallas_codec::utils::KeepRaw;
use pallas_crypto::hash::{Hash, Hasher};
use pallas_primitives::{alonzo, babbage, byron};
pub(crate) trait ToHash<const BYTES: usize> {
fn to_hash(&self) -> pallas_crypto::hash::Hash<BYTES>;
}
impl ToHash<32> for byron::EbbHead {
fn to_hash(&self) -> Hash<32> {
// hash expects to have a prefix for the type of block

View file

@ -5,9 +5,8 @@ use pallas_codec::minicbor;
use pallas_crypto::hash::{Hash, Hasher};
use pallas_primitives::{alonzo, babbage, byron};
use crate::hashes::ToHash;
use crate::time;
use crate::{Era, Error, MultiEraHeader};
use crate::{Era, Error, MultiEraHeader, ToHash};
impl<'b> MultiEraHeader<'b> {
pub fn decode(tag: u8, subtag: Option<u8>, cbor: &'b [u8]) -> Result<Self, Error> {

View file

@ -171,3 +171,7 @@ impl Error {
Error::InvalidUtxoRef(str.to_owned())
}
}
pub trait ToHash<const BYTES: usize> {
fn to_hash(&self) -> pallas_crypto::hash::Hash<BYTES>;
}

View file

@ -4,11 +4,9 @@ use pallas_codec::{minicbor, utils::KeepRaw};
use pallas_crypto::hash::Hash;
use pallas_primitives::{alonzo, babbage, byron};
use crate::hashes::ToHash;
use crate::{
Era, MultiEraCert, MultiEraInput, MultiEraMeta, MultiEraMint, MultiEraOutput, MultiEraSigners,
MultiEraTx, MultiEraWithdrawals, MultiEraWitnesses,
MultiEraTx, MultiEraWithdrawals, MultiEraWitnesses, ToHash,
};
impl<'b> MultiEraTx<'b> {