From 64987e349c5b045cf8bd6abb0c642ba421e51670 Mon Sep 17 00:00:00 2001 From: Andrew Poelstra Date: Wed, 21 Mar 2018 18:49:46 +0000 Subject: [PATCH] minor nits to get compilation to work on rustc 1.14 (currently shipping Debian version) --- src/internal_macros.rs | 4 ++-- src/util/address.rs | 5 ++++- src/util/bip143.rs | 1 + src/util/hash.rs | 2 +- src/util/privkey.rs | 8 ++++++-- 5 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/internal_macros.rs b/src/internal_macros.rs index ece4b51a..351693cc 100644 --- a/src/internal_macros.rs +++ b/src/internal_macros.rs @@ -277,10 +277,10 @@ macro_rules! display_from_debug { } #[cfg(test)] -macro_rules! hex_script (($s:expr) => (Script::from($s.from_hex().unwrap()))); +macro_rules! hex_script (($s:expr) => (::blockdata::script::Script::from($s.from_hex().unwrap()))); #[cfg(test)] -macro_rules! hex_hash (($s:expr) => (Sha256dHash::from(&$s.from_hex().unwrap()[..]))); +macro_rules! hex_hash (($s:expr) => (::util::hash::Sha256dHash::from(&$s.from_hex().unwrap()[..]))); // Macros to replace serde's codegen while that is not stable diff --git a/src/util/address.rs b/src/util/address.rs index 9a8b5d99..d4efde07 100644 --- a/src/util/address.rs +++ b/src/util/address.rs @@ -285,7 +285,10 @@ impl FromStr for Address { x => return Err(Error::Base58(base58::Error::InvalidVersion(vec![x]))) }; - Ok(Address { network, payload }) + Ok(Address { + network: network, + payload: payload, + }) } } diff --git a/src/util/bip143.rs b/src/util/bip143.rs index af271a04..9e3f6bca 100644 --- a/src/util/bip143.rs +++ b/src/util/bip143.rs @@ -101,6 +101,7 @@ impl SighashComponents { mod tests { use serialize::hex::FromHex; + use blockdata::transaction::Transaction; use network::serialize::deserialize; use util::misc::hex_bytes; diff --git a/src/util/hash.rs b/src/util/hash.rs index 5126734d..ccde8a22 100644 --- a/src/util/hash.rs +++ b/src/util/hash.rs @@ -454,7 +454,7 @@ impl MerkleRoot for Vec { mod tests { use strason; - use network::encodable::VarInt; + use network::encodable::{ConsensusEncodable, VarInt}; use network::serialize::{serialize, deserialize}; use util::uint::{Uint128, Uint256}; use super::*; diff --git a/src/util/privkey.rs b/src/util/privkey.rs index 85710c12..fd2c46f0 100644 --- a/src/util/privkey.rs +++ b/src/util/privkey.rs @@ -37,7 +37,11 @@ impl Privkey { /// Creates an address from a public key #[inline] pub fn from_secret_key(key: SecretKey, compressed: bool, network: Network) -> Privkey { - Privkey { compressed, network, key } + Privkey { + compressed: compressed, + network: network, + key: key, + } } /// Computes the public key as supposed to be used with this secret @@ -164,4 +168,4 @@ mod tests { let pk = sk.to_legacy_address(&secp).unwrap(); assert_eq!(&pk.to_string(), "1GhQvF6dL8xa6wBxLnWmHcQsurx9RxiMc8"); } -} \ No newline at end of file +}