1- extern crate core;
2-
31use data_encoding:: HEXUPPER ;
42use multiaddr:: * ;
5- use multihash:: { Code , Multihash } ;
3+ use multihash:: MultihashGeneric ;
64use quickcheck:: { Arbitrary , Gen , QuickCheck } ;
75use std:: {
86 borrow:: Cow ,
@@ -145,14 +143,13 @@ impl Arbitrary for Proto {
145143}
146144
147145#[ derive( Clone , Debug ) ]
148- struct Mh ( Multihash ) ;
146+ struct Mh ( MultihashGeneric < 64 > ) ;
149147
150148impl Arbitrary for Mh {
151149 fn arbitrary ( g : & mut Gen ) -> Self {
152150 let mut hash: [ u8 ; 32 ] = [ 0 ; 32 ] ;
153151 hash. fill_with ( || u8:: arbitrary ( g) ) ;
154- Mh ( Multihash :: wrap ( Code :: Identity . into ( ) , & hash)
155- . expect ( "The digest size is never too large" ) )
152+ Mh ( MultihashGeneric :: wrap ( 0x0 , & hash) . expect ( "The digest size is never too large" ) )
156153 }
157154}
158155
@@ -180,8 +177,8 @@ fn ma_valid(source: &str, target: &str, protocols: Vec<Protocol<'_>>) {
180177 ) ;
181178}
182179
183- fn multihash ( s : & str ) -> Multihash {
184- Multihash :: from_bytes ( & multibase:: Base :: Base58Btc . decode ( s) . unwrap ( ) ) . unwrap ( )
180+ fn multihash ( s : & str ) -> MultihashGeneric < 64 > {
181+ MultihashGeneric :: from_bytes ( & multibase:: Base :: Base58Btc . decode ( s) . unwrap ( ) ) . unwrap ( )
185182}
186183
187184#[ test]
@@ -374,7 +371,7 @@ fn construct_success() {
374371 Ip4 ( local) ,
375372 Udp ( 1234 ) ,
376373 WebRTC ,
377- Certhash ( Multihash :: from_bytes( & decoded) . unwrap( ) ) ,
374+ Certhash ( MultihashGeneric :: from_bytes( & decoded) . unwrap( ) ) ,
378375 ] ,
379376 ) ;
380377
@@ -393,7 +390,7 @@ fn construct_success() {
393390 Ip4 ( local) ,
394391 Udp ( 1234 ) ,
395392 WebTransport ,
396- Certhash ( Multihash :: from_bytes( & decoded) . unwrap( ) ) ,
393+ Certhash ( MultihashGeneric :: from_bytes( & decoded) . unwrap( ) ) ,
397394 ] ,
398395 ) ;
399396}
0 commit comments