File tree 1 file changed +13
-6
lines changed 1 file changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -283,14 +283,18 @@ fn challenge_txin(message: &str) -> TxIn {
283
283
/// Verify the SIGHASH type for a TxIn
284
284
fn verify_sighash_type_all ( inp : & TxIn ) -> bool {
285
285
if inp. witness . is_empty ( ) {
286
- if let Some ( sht ) = inp. script_sig . as_bytes ( ) . last ( ) {
286
+ if let Some ( sht_int ) = inp. script_sig . as_bytes ( ) . last ( ) {
287
287
#[ allow( clippy:: if_same_then_else) ]
288
288
#[ allow( clippy:: needless_bool) ]
289
- if SigHashType :: from_u32 ( * sht as u32 ) == SigHashType :: All {
290
- true
291
- } else if * sht == 174 {
289
+ if * sht_int == 174 {
292
290
// ToDo: What is the meaning of this?
293
291
true
292
+ } else if let Ok ( sht) = SigHashType :: from_u32_standard ( * sht_int as u32 ) {
293
+ if sht == SigHashType :: All {
294
+ true
295
+ } else {
296
+ false
297
+ }
294
298
} else {
295
299
false
296
300
}
@@ -304,8 +308,11 @@ fn verify_sighash_type_all(inp: &TxIn) -> bool {
304
308
// ToDo: Why are there empty elements?
305
309
continue ;
306
310
}
307
- let sht = SigHashType :: from_u32 ( * wit. last ( ) . unwrap ( ) as u32 ) ;
308
- if SigHashType :: All != sht {
311
+ if let Ok ( sht) = SigHashType :: from_u32_standard ( * wit. last ( ) . unwrap ( ) as u32 ) {
312
+ if SigHashType :: All != sht {
313
+ return false ;
314
+ }
315
+ } else {
309
316
return false ;
310
317
}
311
318
}
You can’t perform that action at this time.
0 commit comments