Skip to content

Commit 6ccf6fd

Browse files
committed
chore: migration: use PsbtSigHashType
see rust-bitcoin/rust-bitcoin#779
1 parent 86e9daa commit 6ccf6fd

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

bitcoin/src/light/wallet.rs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
use bitcoincore_rpc::bitcoin::{blockdata::constants::WITNESS_SCALE_FACTOR, PublicKey, Witness, PackedLockTime};
1+
use bitcoincore_rpc::bitcoin::{
2+
blockdata::{constants::WITNESS_SCALE_FACTOR, transaction::NonStandardSighashType},
3+
PackedLockTime, PublicKey, Witness,
4+
};
25

36
use super::{electrs::ElectrsClient, error::Error};
47
use crate::{
@@ -363,7 +366,13 @@ impl Wallet {
363366
.clone()
364367
.expect("utxo is always set in fund_transaction; qed");
365368

366-
let sighash_ty = psbt_input.sighash_type.unwrap_or(SigHashType::All);
369+
// Note: we don't support SchnorrSighashType
370+
let sighash_ty = match psbt_input.sighash_type {
371+
Some(x) => x
372+
.ecdsa_hash_ty()
373+
.map_err(|NonStandardSighashType(ty)| Error::PsbtError(psbt::Error::NonStandardSighashType(ty)))?,
374+
_ => SigHashType::All,
375+
};
367376

368377
// TODO: support signing p2sh, p2pkh, p2wsh
369378
let script_code = if prev_out.script_pubkey.is_v0_p2wpkh() {

0 commit comments

Comments
 (0)