[API BREAK] Remove `Sequence` iterator over secret keys

Y'know, I can't for the life of me think what this was supposed to
be used for. Given that the library did not compile for several
months until last week, I assume there are no users, let alone
users of such a weird feature.
This commit is contained in:
Andrew Poelstra 2015-04-11 12:22:07 -05:00
parent ac61baf040
commit 609f658bee
1 changed files with 0 additions and 34 deletions

View File

@ -102,30 +102,6 @@ impl SecretKey {
} }
} }
} }
#[inline]
/// Returns an iterator for the (sk, pk) pairs starting one after this one,
/// and incrementing by one each time
pub fn sequence(&self, compressed: bool) -> Sequence {
Sequence { last_sk: *self, compressed: compressed }
}
}
/// An iterator of keypairs `(sk + 1, pk*G)`, `(sk + 2, pk*2G)`, ...
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
pub struct Sequence {
compressed: bool,
last_sk: SecretKey,
}
impl Iterator for Sequence {
type Item = (SecretKey, PublicKey);
#[inline]
fn next(&mut self) -> Option<(SecretKey, PublicKey)> {
self.last_sk.add_assign(&ONE).unwrap();
Some((self.last_sk, PublicKey::from_secret_key(&self.last_sk, self.compressed)))
}
} }
impl PublicKey { impl PublicKey {
@ -477,8 +453,6 @@ impl fmt::Debug for SecretKey {
#[cfg(test)] #[cfg(test)]
mod test { mod test {
use test::Bencher;
use super::super::Secp256k1; use super::super::Secp256k1;
use super::super::Error::{InvalidPublicKey, InvalidSecretKey}; use super::super::Error::{InvalidPublicKey, InvalidSecretKey};
use super::{PublicKey, SecretKey}; use super::{PublicKey, SecretKey};
@ -614,14 +588,6 @@ mod test {
assert!(pk2.add_exp_assign(&sk1).is_ok()); assert!(pk2.add_exp_assign(&sk1).is_ok());
assert_eq!(PublicKey::from_secret_key(&sk2, true), pk2); assert_eq!(PublicKey::from_secret_key(&sk2, true), pk2);
} }
#[bench]
pub fn sequence_iterate(bh: &mut Bencher) {
let mut s = Secp256k1::new().unwrap();
let (sk, _) = s.generate_keypair(true);
let mut iter = sk.sequence(true);
bh.iter(|| iter.next())
}
} }