@@ -88,7 +88,7 @@ pub enum InputError {
8888 /// Get the secp Errors directly
8989 SecpErr ( bitcoin:: secp256k1:: Error ) ,
9090 /// Key errors
91- KeyErr ( bitcoin:: key:: Error ) ,
91+ KeyErr ( bitcoin:: key:: FromSliceError ) ,
9292 /// Could not satisfy taproot descriptor
9393 /// This error is returned when both script path and key paths could not be
9494 /// satisfied. We cannot return a detailed error because we try all miniscripts
@@ -231,8 +231,8 @@ impl From<bitcoin::secp256k1::Error> for InputError {
231231}
232232
233233#[ doc( hidden) ]
234- impl From < bitcoin:: key:: Error > for InputError {
235- fn from ( e : bitcoin:: key:: Error ) -> InputError { InputError :: KeyErr ( e) }
234+ impl From < bitcoin:: key:: FromSliceError > for InputError {
235+ fn from ( e : bitcoin:: key:: FromSliceError ) -> InputError { InputError :: KeyErr ( e) }
236236}
237237
238238/// Psbt satisfier for at inputs at a particular index
@@ -395,7 +395,7 @@ fn sanity_check(psbt: &Psbt) -> Result<(), Error> {
395395 None => sighash:: EcdsaSighashType :: All ,
396396 } ;
397397 for ( key, ecdsa_sig) in & input. partial_sigs {
398- let flag = sighash:: EcdsaSighashType :: from_standard ( ecdsa_sig. hash_ty as u32 ) . map_err (
398+ let flag = sighash:: EcdsaSighashType :: from_standard ( ecdsa_sig. sighash_type as u32 ) . map_err (
399399 |_| {
400400 Error :: InputError (
401401 InputError :: Interpreter ( interpreter:: Error :: NonStandardSighash (
@@ -736,7 +736,7 @@ impl PsbtExt for Psbt {
736736 let desc_type = desc. desc_type ( ) ;
737737
738738 if let Some ( non_witness_utxo) = & input. non_witness_utxo {
739- if txin. previous_output . txid != non_witness_utxo. txid ( ) {
739+ if txin. previous_output . txid != non_witness_utxo. compute_txid ( ) {
740740 return Err ( UtxoUpdateError :: UtxoCheck ) ;
741741 }
742742 }
@@ -1315,10 +1315,12 @@ pub enum SighashError {
13151315 MissingSpendUtxos ,
13161316 /// Invalid Sighash type
13171317 InvalidSighashType ,
1318- /// Sighash computation error
1319- /// Only happens when single does not have corresponding output as psbts
1320- /// already have information to compute the sighash
1321- SighashComputationError ( sighash:: Error ) ,
1318+ /// Computation error for taproot sighash.
1319+ SighashTaproot ( sighash:: TaprootError ) ,
1320+ /// Computation error for P2WPKH sighash.
1321+ SighashP2wpkh ( sighash:: P2wpkhError ) ,
1322+ /// Computation error for P2WSH sighash.
1323+ TransactionInputsIndex ( transaction:: InputsIndexError ) ,
13221324 /// Missing Witness script
13231325 MissingWitnessScript ,
13241326 /// Missing Redeem script,
@@ -1334,11 +1336,11 @@ impl fmt::Display for SighashError {
13341336 SighashError :: MissingInputUtxo => write ! ( f, "Missing input utxo in pbst" ) ,
13351337 SighashError :: MissingSpendUtxos => write ! ( f, "Missing Psbt spend utxos" ) ,
13361338 SighashError :: InvalidSighashType => write ! ( f, "Invalid Sighash type" ) ,
1337- SighashError :: SighashComputationError ( e) => {
1338- write ! ( f, "Sighash computation error : {}" , e)
1339- }
13401339 SighashError :: MissingWitnessScript => write ! ( f, "Missing Witness Script" ) ,
13411340 SighashError :: MissingRedeemScript => write ! ( f, "Missing Redeem Script" ) ,
1341+ SighashError :: SighashTaproot ( ref e) => write ! ( f, "sighash taproot: {}" , e) ,
1342+ SighashError :: SighashP2wpkh ( ref e) => write ! ( f, "sighash p2wpkh: {}" , e) ,
1343+ SighashError :: TransactionInputsIndex ( ref e) => write ! ( f, "tx inputs index: {}" , e) ,
13421344 }
13431345 }
13441346}
@@ -1355,13 +1357,24 @@ impl error::Error for SighashError {
13551357 | InvalidSighashType
13561358 | MissingWitnessScript
13571359 | MissingRedeemScript => None ,
1358- SighashComputationError ( e) => Some ( e) ,
1360+ SighashTaproot ( ref e) => Some ( e) ,
1361+ SighashP2wpkh ( ref e) => Some ( e) ,
1362+ TransactionInputsIndex ( ref e) => Some ( e) ,
1363+
13591364 }
13601365 }
13611366}
13621367
1363- impl From < sighash:: Error > for SighashError {
1364- fn from ( e : sighash:: Error ) -> Self { SighashError :: SighashComputationError ( e) }
1368+ impl From < sighash:: TaprootError > for SighashError {
1369+ fn from ( e : sighash:: TaprootError ) -> Self { SighashError :: SighashTaproot ( e) }
1370+ }
1371+
1372+ impl From < sighash:: P2wpkhError > for SighashError {
1373+ fn from ( e : sighash:: P2wpkhError ) -> Self { SighashError :: SighashP2wpkh ( e) }
1374+ }
1375+
1376+ impl From < transaction:: InputsIndexError > for SighashError {
1377+ fn from ( e : transaction:: InputsIndexError ) -> Self { SighashError :: TransactionInputsIndex ( e) }
13651378}
13661379
13671380/// Sighash message(signing data) for a given psbt transaction input.
0 commit comments