Add tests for the premise of the Schnorr contract to the Schnorr crate

This commit is contained in:
Luke Parker
2024-09-15 02:11:49 -04:00
parent 0813351f1f
commit 80ca2b780a
6 changed files with 136 additions and 85 deletions

View File

@@ -37,7 +37,13 @@ impl PublicKey {
None?;
}
Some(PublicKey { A, x_coordinate: x_coordinate.into() })
let x_coordinate: [u8; 32] = x_coordinate.into();
// Returns None if the x-coordinate is 0
// Such keys will never have their signatures able to be verified
if x_coordinate == [0; 32] {
None?;
}
Some(PublicKey { A, x_coordinate })
}
/// The point for this public key.