Skip to content

Commit

Permalink
better PrunePart::encode (thanks joshie)
Browse files Browse the repository at this point in the history
  • Loading branch information
shekhirin committed Jul 6, 2023
1 parent 8a03907 commit 890f491
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions crates/storage/db/src/tables/models/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,9 @@ impl Encode for PrunePart {
type Encoded = [u8; 1];

fn encode(self) -> Self::Encoded {
let mut bytes = BytesMut::with_capacity(1);
self.to_compact(&mut bytes);
bytes.as_ref().try_into().expect("incorrect length")
let mut buf = [0u8];
self.to_compact(&mut buf.as_mut());
buf
}
}

Expand Down

0 comments on commit 890f491

Please sign in to comment.