Skip to content

Commit

Permalink
fix: rename SigHas into Sighash
Browse files Browse the repository at this point in the history
  • Loading branch information
h4sh3d committed May 27, 2022
1 parent 7193f77 commit fcadeb0
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/bitcoin/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use bitcoin::blockdata::transaction::{EcdsaSighashType, OutPoint, TxIn, TxOut};
use bitcoin::util::address;
use bitcoin::util::ecdsa::EcdsaSig;
use bitcoin::util::psbt::{self, PartiallySignedTransaction};
use bitcoin::util::sighash::SigHashCache;
use bitcoin::util::sighash::SighashCache;
use bitcoin::util::taproot::TapSighashHash;

#[cfg(feature = "experimental")]
Expand All @@ -20,7 +20,7 @@ use bitcoin::{
#[cfg(all(feature = "experimental", feature = "taproot"))]
use bitcoin::{
secp256k1::schnorr, util::schnorr::SchnorrSig, util::sighash::Prevouts,
util::sighash::SchnorrSigHashType, XOnlyPublicKey,
util::sighash::SchnorrSighashType, XOnlyPublicKey,
};

use thiserror::Error;
Expand All @@ -45,9 +45,9 @@ pub enum Error {
/// Multi-input transaction is not supported
#[error("Multi-input transaction is not supported")]
MultiUTXOUnsuported,
/// SigHash type is missing
#[error("SigHash type is missing")]
MissingSigHashType,
/// Sighash type is missing
#[error("Sighash type is missing")]
MissingSighashType,
/// Partially signed transaction error
#[error("Partially signed transaction error: `{0}`")]
Psbt(#[from] psbt::Error),
Expand Down Expand Up @@ -255,7 +255,7 @@ where
{
// FIXME: this only accounts for key spend and not for script spend
fn generate_witness_message(&self, _path: ScriptPath) -> Result<TapSighashHash, FError> {
let mut sighash = SigHashCache::new(&self.psbt.unsigned_tx);
let mut sighash = SighashCache::new(&self.psbt.unsigned_tx);

let witness_utxo = self.psbt.inputs[0]
.witness_utxo
Expand All @@ -272,7 +272,7 @@ where
script_pubkey,
}];
sighash
.taproot_key_spend_signature_hash(0, &Prevouts::All(&txouts), SchnorrSigHashType::All)
.taproot_key_spend_signature_hash(0, &Prevouts::All(&txouts), SchnorrSighashType::All)
.map_err(FError::new)
}

Expand All @@ -284,7 +284,7 @@ where
) -> Result<(), FError> {
let sig_all = SchnorrSig {
sig,
hash_ty: SchnorrSigHashType::All,
hash_ty: SchnorrSighashType::All,
};
self.psbt.inputs[0].tap_key_sig = Some(sig_all);
Ok(())
Expand Down

0 comments on commit fcadeb0

Please sign in to comment.