Skip to content

Commit ee0a46e

Browse files
committed
Drop AsRef<[u8]> implementation for TlvRecord
Explicitly using TlvRecord::record_bytes makes reading the code more obvious than hiding which bytes are used in AsRef<[u8]>::as_ref.
1 parent 5955bdd commit ee0a46e

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

lightning/src/offers/merkle.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ fn root_hash(data: &[u8]) -> sha256::Hash {
8888
let mut leaves = Vec::new();
8989
for record in tlv_stream {
9090
if !SIGNATURE_TYPES.contains(&record.r#type) {
91-
leaves.push(tagged_hash_from_engine(leaf_tag.clone(), &record));
91+
leaves.push(tagged_hash_from_engine(leaf_tag.clone(), &record.record_bytes));
9292
leaves.push(tagged_hash_from_engine(nonce_tag.clone(), &record.type_bytes));
9393
}
9494
}
@@ -164,10 +164,6 @@ struct TlvRecord<'a> {
164164
record_bytes: &'a [u8],
165165
}
166166

167-
impl AsRef<[u8]> for TlvRecord<'_> {
168-
fn as_ref(&self) -> &[u8] { &self.record_bytes }
169-
}
170-
171167
impl<'a> Iterator for TlvStream<'a> {
172168
type Item = TlvRecord<'a>;
173169

0 commit comments

Comments
 (0)