Merge pull request #298 from tamasblummer/upgrade_secp_bitcoinconsensus

upgrade to secp256k1 0.15 and bitcoinconsensus 0.17
This commit is contained in:
Carl Dong 2019-08-23 14:18:05 -04:00 committed by GitHub
commit 24361dd2f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 11 deletions

View File

@ -1,3 +1,6 @@
# 0.20.0
* Update `secp256k1` 0.15 and `bitcoinconsensus` 0.17
# 0.19.0 - 2019-08-16 # 0.19.0 - 2019-08-16

View File

@ -1,6 +1,6 @@
[package] [package]
name = "bitcoin" name = "bitcoin"
version = "0.19.2" version = "0.20.0"
authors = ["Andrew Poelstra <apoelstra@wpsoftware.net>"] authors = ["Andrew Poelstra <apoelstra@wpsoftware.net>"]
license = "CC0-1.0" license = "CC0-1.0"
homepage = "https://github.com/rust-bitcoin/rust-bitcoin/" homepage = "https://github.com/rust-bitcoin/rust-bitcoin/"
@ -23,15 +23,13 @@ use-serde = ["serde", "bitcoin_hashes/serde"]
bech32 = "0.7.1" bech32 = "0.7.1"
byteorder = "1.2" byteorder = "1.2"
bitcoin_hashes = "0.7" bitcoin_hashes = "0.7"
bitcoinconsensus = { version = "0.16", optional = true } bitcoinconsensus = { version = "0.17", optional = true }
secp256k1 = "0.12"
serde = { version = "1", optional = true } serde = { version = "1", optional = true }
secp256k1 = "0.15"
[dependencies.hex] hex = "=0.3.2"
version = "=0.3.2"
[dev-dependencies] [dev-dependencies]
serde_derive = "<1.0.99" serde_derive = "<1.0.99"
serde_json = "1" serde_json = "1"
serde_test = "1" serde_test = "1"
secp256k1 = { version = "0.12", features = [ "rand" ] } secp256k1 = { version = "0.15", features = ["rand"] }

View File

@ -497,7 +497,7 @@ mod tests {
use hashes::hex::{FromHex, ToHex}; use hashes::hex::{FromHex, ToHex};
use hashes::{sha256d, Hash}; use hashes::{sha256d, Hash};
use secp256k1::rand::{weak_rng, Rng, XorShiftRng}; use secp256k1::rand::prelude::*;
use consensus::encode::{deserialize, serialize}; use consensus::encode::{deserialize, serialize};
use util::hash::{bitcoin_merkle_root, BitcoinHash}; use util::hash::{bitcoin_merkle_root, BitcoinHash};
@ -506,7 +506,7 @@ mod tests {
#[test] #[test]
fn pmt_tests() { fn pmt_tests() {
let mut rng = weak_rng(); let mut rng = thread_rng();
let tx_counts = vec![1, 4, 7, 17, 56, 100, 127, 256, 312, 513, 1000, 4095]; let tx_counts = vec![1, 4, 7, 17, 56, 100, 127, 256, 312, 513, 1000, 4095];
for num_tx in tx_counts { for num_tx in tx_counts {
@ -693,7 +693,7 @@ mod tests {
impl PartialMerkleTree { impl PartialMerkleTree {
/// Flip one bit in one of the hashes - this should break the authentication /// Flip one bit in one of the hashes - this should break the authentication
fn damage(&mut self, rng: &mut XorShiftRng) { fn damage(&mut self, rng: &mut ThreadRng) {
let n = rng.gen_range(0, self.hashes.len()); let n = rng.gen_range(0, self.hashes.len());
let bit = rng.gen::<u8>(); let bit = rng.gen::<u8>();
let hashes = &mut self.hashes; let hashes = &mut self.hashes;

View File

@ -125,6 +125,7 @@ pub fn signed_msg_hash(msg: &str) -> sha256d::Hash {
#[cfg(all(test, feature="unstable"))] #[cfg(all(test, feature="unstable"))]
mod benches { mod benches {
use secp256k1::rand::{Rng, thread_rng}; use secp256k1::rand::{Rng, thread_rng};
use secp256k1::rand::distributions::Standard;
use super::hex_bytes; use super::hex_bytes;
use test::Bencher; use test::Bencher;
@ -138,7 +139,7 @@ mod benches {
fn bench_from_hex(b: &mut Bencher, data_size: usize) { fn bench_from_hex(b: &mut Bencher, data_size: usize) {
let data_bytes = thread_rng() let data_bytes = thread_rng()
.gen_iter() .sample_iter(&Standard)
.take(data_size) .take(data_size)
.collect::<Vec<u8>>(); .collect::<Vec<u8>>();
let data = join(data_bytes.iter().map(|x| format!("{:02x}", x)), data_size * 2); let data = join(data_bytes.iter().map(|x| format!("{:02x}", x)), data_size * 2);