Skip to content

Commit

Permalink
keys: 🍴 SpendKeyBytes: From<[u8; SPENDKEY_LEN_BYTES]>
Browse files Browse the repository at this point in the history
this saves us a needless length check if we already have an array
in-hand.
  • Loading branch information
cratelyn committed Mar 1, 2024
1 parent a9694cf commit 7d39e5b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions crates/core/keys/src/keys/spend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,12 @@ impl SpendKey {
}
}

impl From<[u8; SPENDKEY_LEN_BYTES]> for SpendKeyBytes {
fn from(bytes: [u8; SPENDKEY_LEN_BYTES]) -> Self {
Self(bytes)
}
}

impl TryFrom<&[u8]> for SpendKeyBytes {
type Error = anyhow::Error;
fn try_from(slice: &[u8]) -> Result<Self, Self::Error> {
Expand Down

0 comments on commit 7d39e5b

Please sign in to comment.