Skip to content

Commit 30fa409

Browse files
committed
Remove local function script_is_v1_p2tr
1 parent 8bbcc83 commit 30fa409

File tree

2 files changed

+3
-17
lines changed

2 files changed

+3
-17
lines changed

src/psbt/finalizer.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
//!
2121
2222
use bitcoin::util::sighash::Prevouts;
23-
use util::{script_is_v1_tr, witness_size};
23+
use util::witness_size;
2424

2525
use super::{sanity_check, Psbt};
2626
use super::{Error, InputError, PsbtInputSatisfier};
@@ -45,7 +45,7 @@ fn construct_tap_witness(
4545
sat: &PsbtInputSatisfier,
4646
allow_mall: bool,
4747
) -> Result<Vec<Vec<u8>>, InputError> {
48-
assert!(script_is_v1_tr(&spk));
48+
assert!(spk.is_v1_p2tr());
4949

5050
// try the script spend path first
5151
if let Some(sig) =
@@ -383,7 +383,7 @@ pub fn finalize_helper<C: secp256k1::Verification>(
383383
let spk = get_scriptpubkey(psbt, index).map_err(|e| Error::InputError(e, index))?;
384384
let sat = PsbtInputSatisfier::new(&psbt, index);
385385

386-
if script_is_v1_tr(spk) {
386+
if spk.is_v1_p2tr() {
387387
// Deal with tr case separately, unfortunately we cannot infer the full descriptor for Tr
388388
let wit = construct_tap_witness(spk, &sat, allow_mall)
389389
.map_err(|e| Error::InputError(e, index))?;

src/util.rs

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
use bitcoin;
2-
use bitcoin::blockdata::opcodes;
32
use bitcoin::blockdata::script;
4-
use bitcoin::blockdata::script::Instruction;
53
use bitcoin::Script;
64
use miniscript::context;
75

@@ -48,15 +46,3 @@ impl MsKeyBuilder for script::Builder {
4846
}
4947
}
5048
}
51-
52-
// This belongs in rust-bitcoin, make this upstream later
53-
pub(crate) fn script_is_v1_tr(s: &Script) -> bool {
54-
let mut iter = s.instructions_minimal();
55-
if s.len() != 32
56-
|| iter.next() != Some(Ok(Instruction::Op(opcodes::all::OP_PUSHNUM_1)))
57-
|| iter.next() != Some(Ok(Instruction::Op(opcodes::all::OP_PUSHBYTES_32)))
58-
{
59-
return false;
60-
}
61-
return true;
62-
}

0 commit comments

Comments
 (0)