Rename bitcoin_hashes dependency to hashes
This commit is contained in:
parent
5f4de0fb46
commit
48f4c1989f
|
@ -20,7 +20,7 @@
|
||||||
//! these blocks and the blockchain.
|
//! these blocks and the blockchain.
|
||||||
//!
|
//!
|
||||||
|
|
||||||
use bitcoin_hashes::{sha256d, Hash};
|
use hashes::{sha256d, Hash};
|
||||||
|
|
||||||
use util;
|
use util;
|
||||||
use util::Error::{BlockBadTarget, BlockBadProofOfWork};
|
use util::Error::{BlockBadTarget, BlockBadProofOfWork};
|
||||||
|
@ -30,7 +30,7 @@ use consensus::encode::Encodable;
|
||||||
use network::constants::Network;
|
use network::constants::Network;
|
||||||
use blockdata::transaction::Transaction;
|
use blockdata::transaction::Transaction;
|
||||||
use blockdata::constants::max_target;
|
use blockdata::constants::max_target;
|
||||||
use bitcoin_hashes::HashEngine;
|
use hashes::HashEngine;
|
||||||
|
|
||||||
/// A block header, which contains all the block's information except
|
/// A block header, which contains all the block's information except
|
||||||
/// the actual transactions
|
/// the actual transactions
|
||||||
|
|
|
@ -31,10 +31,10 @@ use std::{error, fmt, io};
|
||||||
|
|
||||||
use blockdata::opcodes;
|
use blockdata::opcodes;
|
||||||
use consensus::{encode, Decodable, Encodable};
|
use consensus::{encode, Decodable, Encodable};
|
||||||
use bitcoin_hashes::{hash160, sha256, Hash};
|
use hashes::{hash160, sha256, Hash};
|
||||||
#[cfg(feature="bitcoinconsensus")] use bitcoinconsensus;
|
#[cfg(feature="bitcoinconsensus")] use bitcoinconsensus;
|
||||||
#[cfg(feature="bitcoinconsensus")] use std::convert;
|
#[cfg(feature="bitcoinconsensus")] use std::convert;
|
||||||
#[cfg(feature="bitcoinconsensus")] use bitcoin_hashes::sha256d;
|
#[cfg(feature="bitcoinconsensus")] use hashes::sha256d;
|
||||||
|
|
||||||
use util::key::PublicKey;
|
use util::key::PublicKey;
|
||||||
|
|
||||||
|
|
|
@ -28,8 +28,8 @@ use std::default::Default;
|
||||||
use std::{fmt, io};
|
use std::{fmt, io};
|
||||||
#[cfg(feature="bitcoinconsensus")] use std::collections::HashMap;
|
#[cfg(feature="bitcoinconsensus")] use std::collections::HashMap;
|
||||||
|
|
||||||
use bitcoin_hashes::{self, sha256d, Hash};
|
use hashes::{self, sha256d, Hash};
|
||||||
use bitcoin_hashes::hex::FromHex;
|
use hashes::hex::FromHex;
|
||||||
|
|
||||||
use util::hash::BitcoinHash;
|
use util::hash::BitcoinHash;
|
||||||
#[cfg(feature="bitcoinconsensus")] use blockdata::script;
|
#[cfg(feature="bitcoinconsensus")] use blockdata::script;
|
||||||
|
@ -105,7 +105,7 @@ impl fmt::Display for OutPoint {
|
||||||
#[derive(Clone, PartialEq, Eq, Debug)]
|
#[derive(Clone, PartialEq, Eq, Debug)]
|
||||||
pub enum ParseOutPointError {
|
pub enum ParseOutPointError {
|
||||||
/// Error in TXID part.
|
/// Error in TXID part.
|
||||||
Txid(bitcoin_hashes::hex::Error),
|
Txid(hashes::hex::Error),
|
||||||
/// Error in vout part.
|
/// Error in vout part.
|
||||||
Vout(::std::num::ParseIntError),
|
Vout(::std::num::ParseIntError),
|
||||||
/// Error in general format.
|
/// Error in general format.
|
||||||
|
@ -620,8 +620,8 @@ mod tests {
|
||||||
use util::hash::BitcoinHash;
|
use util::hash::BitcoinHash;
|
||||||
use util::misc::hex_bytes;
|
use util::misc::hex_bytes;
|
||||||
|
|
||||||
use bitcoin_hashes::{sha256d, Hash};
|
use hashes::{sha256d, Hash};
|
||||||
use bitcoin_hashes::hex::FromHex;
|
use hashes::hex::FromHex;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_outpoint() {
|
fn test_outpoint() {
|
||||||
|
|
|
@ -38,7 +38,7 @@ use std::io::{Cursor, Read, Write};
|
||||||
use byteorder::{LittleEndian, WriteBytesExt, ReadBytesExt};
|
use byteorder::{LittleEndian, WriteBytesExt, ReadBytesExt};
|
||||||
use hex::encode as hex_encode;
|
use hex::encode as hex_encode;
|
||||||
|
|
||||||
use bitcoin_hashes::{sha256d, Hash as HashTrait};
|
use hashes::{sha256d, Hash as HashTrait};
|
||||||
use secp256k1;
|
use secp256k1;
|
||||||
|
|
||||||
use util::base58;
|
use util::base58;
|
||||||
|
|
|
@ -227,7 +227,7 @@ macro_rules! display_from_debug {
|
||||||
macro_rules! hex_script (($s:expr) => (::blockdata::script::Script::from(::hex::decode($s).unwrap())));
|
macro_rules! hex_script (($s:expr) => (::blockdata::script::Script::from(::hex::decode($s).unwrap())));
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
macro_rules! hex_hash (($s:expr) => (::bitcoin_hashes::sha256d::Hash::from_slice(&::hex::decode($s).unwrap()).unwrap()));
|
macro_rules! hex_hash (($s:expr) => (::hashes::sha256d::Hash::from_slice(&::hex::decode($s).unwrap()).unwrap()));
|
||||||
|
|
||||||
macro_rules! serde_struct_impl {
|
macro_rules! serde_struct_impl {
|
||||||
($name:ident, $($fe:ident),*) => (
|
($name:ident, $($fe:ident),*) => (
|
||||||
|
@ -572,10 +572,10 @@ macro_rules! serde_struct_human_string_impl {
|
||||||
|
|
||||||
/// Implements several traits for byte-based newtypes.
|
/// Implements several traits for byte-based newtypes.
|
||||||
/// Implements:
|
/// Implements:
|
||||||
/// - std::fmt::LowerHex (implies bitcoin_hashes::hex::ToHex)
|
/// - std::fmt::LowerHex (implies hashes::hex::ToHex)
|
||||||
/// - std::fmt::Display
|
/// - std::fmt::Display
|
||||||
/// - std::str::FromStr
|
/// - std::str::FromStr
|
||||||
/// - bitcoin_hashes::hex::FromHex
|
/// - hashes::hex::FromHex
|
||||||
macro_rules! impl_bytes_newtype {
|
macro_rules! impl_bytes_newtype {
|
||||||
($t:ident, $len:expr) => (
|
($t:ident, $len:expr) => (
|
||||||
|
|
||||||
|
@ -594,9 +594,9 @@ macro_rules! impl_bytes_newtype {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ::bitcoin_hashes::hex::FromHex for $t {
|
impl ::hashes::hex::FromHex for $t {
|
||||||
fn from_byte_iter<I>(iter: I) -> Result<Self, bitcoin_hashes::hex::Error>
|
fn from_byte_iter<I>(iter: I) -> Result<Self, ::hashes::hex::Error>
|
||||||
where I: Iterator<Item=Result<u8, bitcoin_hashes::hex::Error>> +
|
where I: Iterator<Item=Result<u8, ::hashes::hex::Error>> +
|
||||||
ExactSizeIterator +
|
ExactSizeIterator +
|
||||||
DoubleEndedIterator,
|
DoubleEndedIterator,
|
||||||
{
|
{
|
||||||
|
@ -607,13 +607,13 @@ macro_rules! impl_bytes_newtype {
|
||||||
}
|
}
|
||||||
Ok($t(ret))
|
Ok($t(ret))
|
||||||
} else {
|
} else {
|
||||||
Err(::bitcoin_hashes::hex::Error::InvalidLength(2 * $len, 2 * iter.len()))
|
Err(::hashes::hex::Error::InvalidLength(2 * $len, 2 * iter.len()))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ::std::str::FromStr for $t {
|
impl ::std::str::FromStr for $t {
|
||||||
type Err = bitcoin_hashes::hex::Error;
|
type Err = ::hashes::hex::Error;
|
||||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||||
hex::FromHex::from_hex(s)
|
hex::FromHex::from_hex(s)
|
||||||
}
|
}
|
||||||
|
@ -623,7 +623,7 @@ macro_rules! impl_bytes_newtype {
|
||||||
impl ::serde::Serialize for $t {
|
impl ::serde::Serialize for $t {
|
||||||
fn serialize<S: ::serde::Serializer>(&self, s: S) -> Result<S::Ok, S::Error> {
|
fn serialize<S: ::serde::Serializer>(&self, s: S) -> Result<S::Ok, S::Error> {
|
||||||
if s.is_human_readable() {
|
if s.is_human_readable() {
|
||||||
s.serialize_str(&::bitcoin_hashes::hex::ToHex::to_hex(self))
|
s.serialize_str(&::hashes::hex::ToHex::to_hex(self))
|
||||||
} else {
|
} else {
|
||||||
s.serialize_bytes(&self[..])
|
s.serialize_bytes(&self[..])
|
||||||
}
|
}
|
||||||
|
@ -648,7 +648,7 @@ macro_rules! impl_bytes_newtype {
|
||||||
E: ::serde::de::Error,
|
E: ::serde::de::Error,
|
||||||
{
|
{
|
||||||
if let Ok(hex) = ::std::str::from_utf8(v) {
|
if let Ok(hex) = ::std::str::from_utf8(v) {
|
||||||
::bitcoin_hashes::hex::FromHex::from_hex(hex).map_err(E::custom)
|
::hashes::hex::FromHex::from_hex(hex).map_err(E::custom)
|
||||||
} else {
|
} else {
|
||||||
return Err(E::invalid_value(::serde::de::Unexpected::Bytes(v), &self));
|
return Err(E::invalid_value(::serde::de::Unexpected::Bytes(v), &self));
|
||||||
}
|
}
|
||||||
|
@ -658,7 +658,7 @@ macro_rules! impl_bytes_newtype {
|
||||||
where
|
where
|
||||||
E: ::serde::de::Error,
|
E: ::serde::de::Error,
|
||||||
{
|
{
|
||||||
::bitcoin_hashes::hex::FromHex::from_hex(v).map_err(E::custom)
|
::hashes::hex::FromHex::from_hex(v).map_err(E::custom)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@
|
||||||
|
|
||||||
|
|
||||||
extern crate bech32;
|
extern crate bech32;
|
||||||
extern crate bitcoin_hashes;
|
extern crate bitcoin_hashes as hashes;
|
||||||
extern crate byteorder;
|
extern crate byteorder;
|
||||||
extern crate hex;
|
extern crate hex;
|
||||||
extern crate secp256k1;
|
extern crate secp256k1;
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
use network::constants;
|
use network::constants;
|
||||||
use consensus::encode::{self, Decodable, Encodable};
|
use consensus::encode::{self, Decodable, Encodable};
|
||||||
use bitcoin_hashes::sha256d;
|
use hashes::sha256d;
|
||||||
|
|
||||||
use std::io;
|
use std::io;
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
//!
|
//!
|
||||||
//! BIP157 Client Side Block Filtering network messages
|
//! BIP157 Client Side Block Filtering network messages
|
||||||
//!
|
//!
|
||||||
use bitcoin_hashes::sha256d;
|
use hashes::sha256d;
|
||||||
|
|
||||||
#[derive(PartialEq, Eq, Clone, Debug)]
|
#[derive(PartialEq, Eq, Clone, Debug)]
|
||||||
/// getcfilters message
|
/// getcfilters message
|
||||||
|
|
|
@ -44,7 +44,7 @@ use std::fmt::{self, Display, Formatter};
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
|
||||||
use bech32;
|
use bech32;
|
||||||
use bitcoin_hashes::{hash160, sha256, Hash};
|
use hashes::{hash160, sha256, Hash};
|
||||||
|
|
||||||
use blockdata::opcodes;
|
use blockdata::opcodes;
|
||||||
use blockdata::script;
|
use blockdata::script;
|
||||||
|
@ -505,7 +505,7 @@ mod tests {
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
use std::string::ToString;
|
use std::string::ToString;
|
||||||
|
|
||||||
use bitcoin_hashes::{hash160, Hash};
|
use hashes::{hash160, Hash};
|
||||||
use hex::{decode as hex_decode, encode as hex_encode};
|
use hex::{decode as hex_decode, encode as hex_encode};
|
||||||
|
|
||||||
use blockdata::script::Script;
|
use blockdata::script::Script;
|
||||||
|
|
|
@ -18,7 +18,7 @@ use std::{error, fmt, str, slice, iter};
|
||||||
|
|
||||||
use byteorder::{ByteOrder, LittleEndian};
|
use byteorder::{ByteOrder, LittleEndian};
|
||||||
|
|
||||||
use bitcoin_hashes::{sha256d, Hash};
|
use hashes::{sha256d, Hash};
|
||||||
|
|
||||||
/// An error that might occur during base58 decoding
|
/// An error that might occur during base58 decoding
|
||||||
#[derive(Debug, PartialEq, Eq, Clone)]
|
#[derive(Debug, PartialEq, Eq, Clone)]
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
//! signatures, which are placed in the scriptSig.
|
//! signatures, which are placed in the scriptSig.
|
||||||
//!
|
//!
|
||||||
|
|
||||||
use bitcoin_hashes::{sha256d, Hash};
|
use hashes::{sha256d, Hash};
|
||||||
|
|
||||||
use blockdata::script::Script;
|
use blockdata::script::Script;
|
||||||
use blockdata::transaction::{Transaction, TxIn};
|
use blockdata::transaction::{Transaction, TxIn};
|
||||||
|
|
|
@ -50,7 +50,7 @@ use std::error;
|
||||||
use std::fmt::{Display, Formatter};
|
use std::fmt::{Display, Formatter};
|
||||||
use std::io::Cursor;
|
use std::io::Cursor;
|
||||||
|
|
||||||
use bitcoin_hashes::{Hash, sha256d, siphash24};
|
use hashes::{Hash, sha256d, siphash24};
|
||||||
use byteorder::{ByteOrder, LittleEndian};
|
use byteorder::{ByteOrder, LittleEndian};
|
||||||
|
|
||||||
use blockdata::block::Block;
|
use blockdata::block::Block;
|
||||||
|
@ -523,7 +523,7 @@ mod test {
|
||||||
use std::collections::{HashSet, HashMap};
|
use std::collections::{HashSet, HashMap};
|
||||||
use std::io::Cursor;
|
use std::io::Cursor;
|
||||||
|
|
||||||
use bitcoin_hashes::hex::FromHex;
|
use hashes::hex::FromHex;
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ use std::str::FromStr;
|
||||||
#[cfg(feature = "serde")] use serde;
|
#[cfg(feature = "serde")] use serde;
|
||||||
|
|
||||||
use byteorder::{BigEndian, ByteOrder, ReadBytesExt};
|
use byteorder::{BigEndian, ByteOrder, ReadBytesExt};
|
||||||
use bitcoin_hashes::{self, hex, hash160, sha512, Hash, HashEngine, Hmac, HmacEngine};
|
use hashes::{hex, hash160, sha512, Hash, HashEngine, Hmac, HmacEngine};
|
||||||
use secp256k1::{self, Secp256k1};
|
use secp256k1::{self, Secp256k1};
|
||||||
|
|
||||||
use network::constants::Network;
|
use network::constants::Network;
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
use secp256k1::{self, Secp256k1};
|
use secp256k1::{self, Secp256k1};
|
||||||
use PrivateKey;
|
use PrivateKey;
|
||||||
use PublicKey;
|
use PublicKey;
|
||||||
use bitcoin_hashes::{hash160, sha256, Hash, HashEngine, Hmac, HmacEngine};
|
use hashes::{hash160, sha256, Hash, HashEngine, Hmac, HmacEngine};
|
||||||
use blockdata::{opcodes, script};
|
use blockdata::{opcodes, script};
|
||||||
|
|
||||||
use std::{error, fmt};
|
use std::{error, fmt};
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
use std::cmp::min;
|
use std::cmp::min;
|
||||||
use std::default::Default;
|
use std::default::Default;
|
||||||
|
|
||||||
use bitcoin_hashes::{sha256d, Hash};
|
use hashes::{sha256d, Hash};
|
||||||
|
|
||||||
use consensus::encode::Encodable;
|
use consensus::encode::Encodable;
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,7 @@
|
||||||
use std::collections::HashSet;
|
use std::collections::HashSet;
|
||||||
use std::io;
|
use std::io;
|
||||||
|
|
||||||
use bitcoin_hashes::{sha256d, Hash};
|
use hashes::{sha256d, Hash};
|
||||||
|
|
||||||
use blockdata::constants::{MAX_BLOCK_WEIGHT, MIN_TRANSACTION_WEIGHT};
|
use blockdata::constants::{MAX_BLOCK_WEIGHT, MIN_TRANSACTION_WEIGHT};
|
||||||
use consensus::encode::{self, Decodable, Encodable};
|
use consensus::encode::{self, Decodable, Encodable};
|
||||||
|
@ -498,8 +498,8 @@ impl Decodable for MerkleBlock {
|
||||||
mod tests {
|
mod tests {
|
||||||
use std::cmp::min;
|
use std::cmp::min;
|
||||||
|
|
||||||
use bitcoin_hashes::hex::{FromHex, ToHex};
|
use hashes::hex::{FromHex, ToHex};
|
||||||
use bitcoin_hashes::{sha256d, Hash};
|
use hashes::{sha256d, Hash};
|
||||||
use secp256k1::rand::{weak_rng, Rng, XorShiftRng};
|
use secp256k1::rand::{weak_rng, Rng, XorShiftRng};
|
||||||
|
|
||||||
use consensus::encode::{deserialize, serialize};
|
use consensus::encode::{deserialize, serialize};
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
//!
|
//!
|
||||||
//! Various utility functions
|
//! Various utility functions
|
||||||
|
|
||||||
use bitcoin_hashes::{sha256d, Hash};
|
use hashes::{sha256d, Hash};
|
||||||
use blockdata::opcodes;
|
use blockdata::opcodes;
|
||||||
use consensus::encode;
|
use consensus::encode;
|
||||||
|
|
||||||
|
@ -173,7 +173,7 @@ mod benches {
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use bitcoin_hashes::hex::ToHex;
|
use hashes::hex::ToHex;
|
||||||
use super::script_find_and_remove;
|
use super::script_find_and_remove;
|
||||||
use super::hex_bytes;
|
use super::hex_bytes;
|
||||||
use super::signed_msg_hash;
|
use super::signed_msg_hash;
|
||||||
|
|
|
@ -162,8 +162,8 @@ impl Decodable for PartiallySignedTransaction {
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use bitcoin_hashes::hex::FromHex;
|
use hashes::hex::FromHex;
|
||||||
use bitcoin_hashes::sha256d;
|
use hashes::sha256d;
|
||||||
|
|
||||||
use std::collections::BTreeMap;
|
use std::collections::BTreeMap;
|
||||||
|
|
||||||
|
@ -314,8 +314,8 @@ mod tests {
|
||||||
|
|
||||||
use hex::decode as hex_decode;
|
use hex::decode as hex_decode;
|
||||||
|
|
||||||
use bitcoin_hashes::hex::FromHex;
|
use hashes::hex::FromHex;
|
||||||
use bitcoin_hashes::sha256d;
|
use hashes::sha256d;
|
||||||
|
|
||||||
use blockdata::script::Script;
|
use blockdata::script::Script;
|
||||||
use blockdata::transaction::{SigHashType, Transaction, TxIn, TxOut, OutPoint};
|
use blockdata::transaction::{SigHashType, Transaction, TxIn, TxOut, OutPoint};
|
||||||
|
|
Loading…
Reference in New Issue