Skip to content

Commit 3e5bf16

Browse files
committed
adapted to the updated version of the bitcoin crate
1 parent ea181a0 commit 3e5bf16

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

src/wallet/reserves.rs

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -283,14 +283,18 @@ fn challenge_txin(message: &str) -> TxIn {
283283
/// Verify the SIGHASH type for a TxIn
284284
fn verify_sighash_type_all(inp: &TxIn) -> bool {
285285
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() {
287287
#[allow(clippy::if_same_then_else)]
288288
#[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 {
292290
// ToDo: What is the meaning of this?
293291
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+
}
294298
} else {
295299
false
296300
}
@@ -304,8 +308,11 @@ fn verify_sighash_type_all(inp: &TxIn) -> bool {
304308
// ToDo: Why are there empty elements?
305309
continue;
306310
}
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 {
309316
return false;
310317
}
311318
}

0 commit comments

Comments
 (0)