Fixing namespaces in `impl_hashencode`

This commit is contained in:
Dr Maxim Orlovsky 2020-01-22 11:28:11 +01:00
parent f3e762b555
commit 9c0f4b1a60
1 changed files with 8 additions and 9 deletions

View File

@ -16,23 +16,22 @@
//! to avoid mixing data of the same hash format (like SHA256d) but of different meaning //! to avoid mixing data of the same hash format (like SHA256d) but of different meaning
//! (transaction id, block hash etc). //! (transaction id, block hash etc).
use std::io;
use consensus::encode::{Encodable, Decodable, Error}; use consensus::encode::{Encodable, Decodable, Error};
use hashes::{sha256, sha256d, hash160, Hash}; use hashes::{Hash, sha256, sha256d, ripemd160, hash160};
use hashes::hex::{ToHex, FromHex}; use hashes::hex::{FromHex, ToHex};
macro_rules! impl_hashencode { macro_rules! impl_hashencode {
($hashtype:ident) => { ($hashtype:ident) => {
impl Encodable for $hashtype { impl $crate::consensus::Encodable for $hashtype {
fn consensus_encode<S: io::Write>(&self, s: S) -> Result<usize, Error> { fn consensus_encode<S: ::std::io::Write>(&self, s: S) -> Result<usize, $crate::consensus::encode::Error> {
self.0.consensus_encode(s) self.0.consensus_encode(s)
} }
} }
impl Decodable for $hashtype { impl $crate::consensus::Decodable for $hashtype {
fn consensus_decode<D: io::Read>(d: D) -> Result<Self, Error> { fn consensus_decode<D: ::std::io::Read>(d: D) -> Result<Self, $crate::consensus::encode::Error> {
Ok(Self::from_inner(<<$hashtype as Hash>::Inner>::consensus_decode(d)?)) use $crate::hashes::Hash;
Ok(Self::from_inner(<<$hashtype as $crate::hashes::Hash>::Inner>::consensus_decode(d)?))
} }
} }
} }