3.11 Better document API expectations

This commit is contained in:
Luke Parker
2023-07-19 23:51:21 -04:00
parent df67b7d94c
commit 6f9d02fdf8
3 changed files with 11 additions and 3 deletions

View File

@@ -37,8 +37,9 @@ pub fn x_only(key: &ProjectivePoint) -> XOnlyPublicKey {
XOnlyPublicKey::from_slice(&x(key)).expect("x_only was passed a point which was infinity or odd")
}
/// Make a point even by adding the generator until it is even. Returns the even point and the
/// amount of additions required.
/// Make a point even by adding the generator until it is even.
///
/// Returns the even point and the amount of additions required.
pub fn make_even(mut key: ProjectivePoint) -> (ProjectivePoint, u64) {
let mut c = 0;
while key.to_encoded_point(true).tag() == Tag::CompressedOddY {
@@ -51,6 +52,8 @@ pub fn make_even(mut key: ProjectivePoint) -> (ProjectivePoint, u64) {
/// A BIP-340 compatible HRAm for use with the modular-frost Schnorr Algorithm.
///
/// If passed an odd nonce, it will have the generator added until it is even.
///
/// If the key is odd, this will panic.
#[derive(Clone, Copy, Debug)]
pub struct Hram;