Remove alloc for extensions

This commit is contained in:
Tyler Beckman 2024-10-25 22:04:17 -06:00
parent 0904b73c12
commit 94a8343be7
Signed by: Ty
GPG key ID: 2813440C772555A4
2 changed files with 4 additions and 4 deletions

View file

@ -7,7 +7,7 @@ pub enum Version {
V1 = 0
}
pub type CtExtensions = Vec<u8>;
pub type CtExtensions<'a> = &'a [u8];
#[repr(u8)]
#[non_exhaustive]
@ -16,7 +16,7 @@ pub enum MerkleLeafType<'a> {
TimeStampedEntry {
timestamp: u64,
entry_type: LogEntryType<'a>,
extensions: CtExtensions
extensions: CtExtensions<'a>
} = 0
}

View file

@ -95,14 +95,14 @@ pub fn parse_merkle_tree_leaf(
let (
_, // no more to parse
ct_extensions // opaque CtExtensions<0..2^16-1>
extensions // opaque CtExtensions<0..2^16-1>
) = nom::multi::length_data(nom::number::complete::be_u16)(input)
.map_err(|e| e.map(|e| LeafParsingError::Nom(e)))?;
MerkleLeafType::TimeStampedEntry {
timestamp,
entry_type,
extensions: ct_extensions.to_vec()
extensions
}
}
_ =>