Skip to content

Commit 7543a5d

Browse files
committed
fix(cardano-blockchain-types): improve verifying key error log
Signed-off-by: bkioshn <[email protected]>
1 parent 3b1ae1b commit 7543a5d

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

rust/cardano-blockchain-types/src/metadata/cip36/key_registration.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -302,8 +302,12 @@ fn decode_voting_key(
302302

303303
/// Helper function for converting `&[u8]` to `VerifyingKey`.
304304
fn voting_pk_vec_to_verifying_key(pub_key: &[u8]) -> anyhow::Result<VerifyingKey> {
305-
let bytes = pub_key.try_into().context("Invalid verifying key length")?;
306-
VerifyingKey::from_bytes(bytes).context("Failed to convert to VerifyingKey")
305+
let bytes = pub_key.try_into().context(format!(
306+
"Invalid verifying key length got {}",
307+
pub_key.len()
308+
))?;
309+
VerifyingKey::from_bytes(bytes)
310+
.map_err(|e| anyhow::anyhow!("Failed to convert to VerifyingKey: {:?}", e))
307311
}
308312

309313
/// Helper function for decoding the stake public key.

0 commit comments

Comments
 (0)