upgrade to secp256k1 0.15 and bitcoinconsensus 0.17

This commit is contained in:
Tamas Blummer 2019-07-27 09:28:51 +02:00
parent 8ff904c747
commit 9f3e355c5c
3 changed files with 10 additions and 7 deletions

View File

@ -23,15 +23,17 @@ use-serde = ["serde", "bitcoin_hashes/serde"]
bech32 = "0.7.1"
byteorder = "1.2"
bitcoin_hashes = "0.7"
bitcoinconsensus = { version = "0.16", optional = true }
secp256k1 = "0.12"
bitcoinconsensus = { version = "0.17", optional = true }
serde = { version = "1", optional = true }
[dependencies.hex]
version = "=0.3.2"
[dependencies.secp256k1]
version = "0.15"
features = [ "rand" ]
[dev-dependencies]
serde_derive = "<1.0.99"
serde_json = "1"
serde_test = "1"
secp256k1 = { version = "0.12", features = [ "rand" ] }

View File

@ -497,7 +497,7 @@ mod tests {
use hashes::hex::{FromHex, ToHex};
use hashes::{sha256d, Hash};
use secp256k1::rand::{weak_rng, Rng, XorShiftRng};
use secp256k1::rand::prelude::*;
use consensus::encode::{deserialize, serialize};
use util::hash::{bitcoin_merkle_root, BitcoinHash};
@ -506,7 +506,7 @@ mod tests {
#[test]
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];
for num_tx in tx_counts {
@ -693,7 +693,7 @@ mod tests {
impl PartialMerkleTree {
/// 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 bit = rng.gen::<u8>();
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"))]
mod benches {
use secp256k1::rand::{Rng, thread_rng};
use secp256k1::rand::distributions::Standard;
use super::hex_bytes;
use test::Bencher;
@ -138,7 +139,7 @@ mod benches {
fn bench_from_hex(b: &mut Bencher, data_size: usize) {
let data_bytes = thread_rng()
.gen_iter()
.sample_iter(&Standard)
.take(data_size)
.collect::<Vec<u8>>();
let data = join(data_bytes.iter().map(|x| format!("{:02x}", x)), data_size * 2);