Skip to content

Commit

Permalink
adapted to the updated version of the bitcoin crate
Browse files Browse the repository at this point in the history
  • Loading branch information
ulrichard committed Jun 11, 2021
1 parent 061cfbd commit b5519c0
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions src/wallet/reserves.rs
Original file line number Diff line number Diff line change
Expand Up @@ -283,14 +283,18 @@ fn challenge_txin(message: &str) -> TxIn {
/// Verify the SIGHASH type for a TxIn
fn verify_sighash_type_all(inp: &TxIn) -> bool {
if inp.witness.is_empty() {
if let Some(sht) = inp.script_sig.as_bytes().last() {
if let Some(sht_int) = inp.script_sig.as_bytes().last() {
#[allow(clippy::if_same_then_else)]
#[allow(clippy::needless_bool)]
if SigHashType::from_u32(*sht as u32) == SigHashType::All {
true
} else if *sht == 174 {
if *sht_int == 174 {
// ToDo: What is the meaning of this?
true
} else if let Ok(sht) = SigHashType::from_u32_standard(*sht_int as u32) {
if sht == SigHashType::All {
true
} else {
false
}
} else {
false
}
Expand All @@ -304,8 +308,11 @@ fn verify_sighash_type_all(inp: &TxIn) -> bool {
// ToDo: Why are there empty elements?
continue;
}
let sht = SigHashType::from_u32(*wit.last().unwrap() as u32);
if SigHashType::All != sht {
if let Ok(sht) = SigHashType::from_u32_standard(*wit.last().unwrap() as u32) {
if SigHashType::All != sht {
return false;
}
} else {
return false;
}
}
Expand Down

0 comments on commit b5519c0

Please sign in to comment.