@@ -666,11 +666,11 @@ impl Decodable for Transaction {
666
666
/// This type is consensus valid but an input including it would prevent the transaction from
667
667
/// being relayed on today's Bitcoin network.
668
668
#[ derive( Debug , Copy , Clone , PartialEq , Eq , PartialOrd , Ord , Hash ) ]
669
- pub struct NonStandardSigHashType ;
669
+ pub struct NonStandardSigHashType ( pub u32 ) ;
670
670
671
671
impl fmt:: Display for NonStandardSigHashType {
672
672
fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
673
- write ! ( f, "Non standard sighash type" )
673
+ write ! ( f, "Non standard sighash type {}" , self . 0 )
674
674
}
675
675
}
676
676
@@ -789,7 +789,7 @@ impl EcdsaSigHashType {
789
789
0x81 => Ok ( EcdsaSigHashType :: AllPlusAnyoneCanPay ) ,
790
790
0x82 => Ok ( EcdsaSigHashType :: NonePlusAnyoneCanPay ) ,
791
791
0x83 => Ok ( EcdsaSigHashType :: SinglePlusAnyoneCanPay ) ,
792
- _ => Err ( NonStandardSigHashType )
792
+ non_standard => Err ( NonStandardSigHashType ( non_standard ) )
793
793
}
794
794
}
795
795
@@ -1151,7 +1151,7 @@ mod tests {
1151
1151
assert_eq ! ( EcdsaSigHashType :: from_u32( nonstandard_hashtype) , EcdsaSigHashType :: All ) ;
1152
1152
assert_eq ! ( EcdsaSigHashType :: from_u32_consensus( nonstandard_hashtype) , EcdsaSigHashType :: All ) ;
1153
1153
// But it's policy-invalid to use it!
1154
- assert_eq ! ( EcdsaSigHashType :: from_u32_standard( nonstandard_hashtype) , Err ( NonStandardSigHashType ) ) ;
1154
+ assert_eq ! ( EcdsaSigHashType :: from_u32_standard( nonstandard_hashtype) , Err ( NonStandardSigHashType ( 0x04 ) ) ) ;
1155
1155
}
1156
1156
1157
1157
// These test vectors were stolen from libbtc, which is Copyright 2014 Jonas Schnelli MIT
0 commit comments