Fix for upstream

This commit is contained in:
Andrew Poelstra 2014-08-28 11:13:33 -07:00
parent 94cecfbd60
commit 38f8132067
2 changed files with 4 additions and 5 deletions

View File

@ -411,7 +411,7 @@ impl<D:SimpleDecoder<E>, E, K:ConsensusDecodable<D, E>, V:ConsensusDecodable<D,
} }
/// Iterator /// Iterator
pub struct Items<'tree, K, V> { pub struct Items<'tree, K: 'tree, V: 'tree> {
started: bool, started: bool,
node: Option<&'tree PatriciaTree<K, V>>, node: Option<&'tree PatriciaTree<K, V>>,
parents: Vec<&'tree PatriciaTree<K, V>> parents: Vec<&'tree PatriciaTree<K, V>>

View File

@ -126,8 +126,8 @@ impl ExtendedPrivKey {
if n >= (1 << 31) { return Err(InvalidChildNumber(i)) } if n >= (1 << 31) { return Err(InvalidChildNumber(i)) }
// Non-hardened key: compute public data and use that // Non-hardened key: compute public data and use that
secp256k1::init(); secp256k1::init();
// Unsafety just because I have to call the init() function // Note the unwrap: this is fine, we checked the SK when we created it
hmac.input(unsafe { PublicKey::from_secret_key(&self.secret_key, true).as_slice() }); hmac.input(PublicKey::from_secret_key(&self.secret_key, true).as_slice());
u64_to_be_bytes(n as u64, 4, |raw| hmac.input(raw)); u64_to_be_bytes(n as u64, 4, |raw| hmac.input(raw));
} }
Hardened(n) => { Hardened(n) => {
@ -185,8 +185,7 @@ impl ExtendedPubKey {
depth: sk.depth, depth: sk.depth,
parent_fingerprint: sk.parent_fingerprint, parent_fingerprint: sk.parent_fingerprint,
child_number: sk.child_number, child_number: sk.child_number,
// Unsafety because we needed to run `init` above first public_key: PublicKey::from_secret_key(&sk.secret_key, true),
public_key: unsafe { PublicKey::from_secret_key(&sk.secret_key, true) },
chain_code: sk.chain_code chain_code: sk.chain_code
} }
} }