merge some upstream improvements, set new checkpoint blockhigh
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
use ring::{
|
||||
digest,
|
||||
hmac::{SigningContext, SigningKey},
|
||||
hmac::{self, Context, Key},
|
||||
};
|
||||
use lazy_static::lazy_static;
|
||||
use secp256k1::{PublicKey, Secp256k1, SecretKey, SignOnly, VerifyOnly, Error};
|
||||
@@ -74,8 +73,8 @@ impl ExtendedPrivKey {
|
||||
/// Generate an ExtendedPrivKey from seed
|
||||
pub fn with_seed(seed: &[u8]) -> Result<ExtendedPrivKey, Error> {
|
||||
let signature = {
|
||||
let signing_key = SigningKey::new(&digest::SHA512, b"Bitcoin seed");
|
||||
let mut h = SigningContext::with_key(&signing_key);
|
||||
let signing_key = Key::new(hmac::HMAC_SHA512, b"Bitcoin seed");
|
||||
let mut h = Context::with_key(&signing_key);
|
||||
h.update(&seed);
|
||||
h.sign()
|
||||
};
|
||||
@@ -88,18 +87,18 @@ impl ExtendedPrivKey {
|
||||
})
|
||||
}
|
||||
|
||||
fn sign_hardended_key(&self, index: u32) -> ring::hmac::Signature {
|
||||
let signing_key = SigningKey::new(&digest::SHA512, &self.chain_code);
|
||||
let mut h = SigningContext::with_key(&signing_key);
|
||||
fn sign_hardended_key(&self, index: u32) -> ring::hmac::Tag {
|
||||
let signing_key = Key::new(hmac::HMAC_SHA512, &self.chain_code);
|
||||
let mut h = Context::with_key(&signing_key);
|
||||
h.update(&[0x00]);
|
||||
h.update(&self.private_key[..]);
|
||||
h.update(&index.to_be_bytes());
|
||||
h.sign()
|
||||
}
|
||||
|
||||
fn sign_normal_key(&self, index: u32) -> ring::hmac::Signature {
|
||||
let signing_key = SigningKey::new(&digest::SHA512, &self.chain_code);
|
||||
let mut h = SigningContext::with_key(&signing_key);
|
||||
fn sign_normal_key(&self, index: u32) -> ring::hmac::Tag {
|
||||
let signing_key = Key::new(hmac::HMAC_SHA512, &self.chain_code);
|
||||
let mut h = Context::with_key(&signing_key);
|
||||
let public_key = PublicKey::from_secret_key(&SECP256K1_SIGN_ONLY, &self.private_key);
|
||||
h.update(&public_key.serialize());
|
||||
h.update(&index.to_be_bytes());
|
||||
|
||||
Reference in New Issue
Block a user