@@ -24,7 +24,7 @@ impl Signature {
2424 }
2525}
2626
27- impl Bech32m < 1 , { Signature :: LEN } > for Signature {
27+ impl Bech32m < 2 , { Signature :: LEN } > for Signature {
2828 const HRP : Hrp = Hrp :: parse_unchecked ( "signature" ) ;
2929 const TYPE : & ' static str = "signature" ;
3030 type Suffix = Vec < u8 > ;
@@ -55,14 +55,14 @@ impl FromStr for Signature {
5555
5656 fn from_str ( signature : & str ) -> Result < Self , Self :: Err > {
5757 let Bech32mPayload {
58- prefix : [ scheme] ,
58+ prefix : [ scheme, version ] ,
5959 data,
6060 suffix,
6161 } = Self :: decode_bech32m ( signature) ?;
6262
6363 Ok ( Self {
6464 inner : ed25519_dalek:: Signature :: from_bytes ( & data) ,
65- scheme : SignatureScheme :: new ( scheme, suffix) ?,
65+ scheme : SignatureScheme :: new ( scheme, version , suffix) ?,
6666 } )
6767 }
6868}
@@ -97,13 +97,14 @@ mod tests {
9797
9898 assert_eq ! (
9999 bech32m. parse:: <Signature >( ) . unwrap_err( ) . to_string( ) ,
100- "expected bech32m signature to have 1 prefix character but found 0" ,
100+ "expected bech32m signature to have 2 prefix characters but found 0" ,
101101 ) ;
102102 }
103103
104104 #[ test]
105105 fn unsupported_scheme ( ) {
106106 let bech32m = iter:: once ( Fe32 :: Q )
107+ . chain ( iter:: once ( Fe32 :: _0) )
107108 . chain ( [ 0u8 ; Signature :: LEN ] . iter ( ) . copied ( ) . bytes_to_fes ( ) )
108109 . with_checksum :: < bech32:: Bech32m > ( & Signature :: HRP )
109110 . with_witness_version ( Fe32 :: A )
@@ -112,7 +113,7 @@ mod tests {
112113
113114 assert_eq ! (
114115 bech32m. parse:: <Signature >( ) . unwrap_err( ) . to_string( ) ,
115- "bech32m signature scheme `q` is not supported" ,
116+ "signature scheme `q` is not supported" ,
116117 ) ;
117118 }
118119}
0 commit comments