Skip to content

Commit f85036a

Browse files
committed
bitcoind-tests: Adapt to Simplicity
These tests silently broke when we changed the tap tree iterator.
1 parent 029848c commit f85036a

File tree

4 files changed

+16
-16
lines changed

4 files changed

+16
-16
lines changed

bitcoind-tests/tests/test_arith.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
66
use elements::pset::PartiallySignedTransaction as Psbt;
77
use elements::sighash::SigHashCache;
8-
use elements::taproot::{LeafVersion, TapLeafHash};
8+
use elements::taproot::TapLeafHash;
99
use elements::{
1010
confidential, pset as psbt, secp256k1_zkp as secp256k1, sighash, OutPoint, Script, Sequence,
1111
TxIn, TxOut, Txid,
@@ -107,9 +107,9 @@ pub fn test_desc_satisfy(cl: &ElementsD, testdata: &TestData, desc: &str) -> Vec
107107
// ------------------ script spend -------------
108108
let x_only_keypairs_reqd: Vec<(secp256k1::KeyPair, TapLeafHash)> = tr
109109
.iter_scripts()
110-
.flat_map(|(_depth, ms)| {
111-
let leaf_hash = TapLeafHash::from_script(&ms.encode(), LeafVersion::default());
112-
ms.iter_pk().filter_map(move |pk| {
110+
.flat_map(|(_depth, script)| {
111+
let leaf_hash = TapLeafHash::from_script(&script.encode(), script.version());
112+
script.iter_pk().filter_map(move |pk| {
113113
let i = x_only_pks.iter().position(|&x| x.to_public_key() == pk);
114114
i.map(|idx| (xonly_keypairs[idx], leaf_hash))
115115
})

bitcoind-tests/tests/test_csfs.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
66
use elements::pset::PartiallySignedTransaction as Psbt;
77
use elements::sighash::SigHashCache;
8-
use elements::taproot::{LeafVersion, TapLeafHash};
8+
use elements::taproot::TapLeafHash;
99
use elements::{
1010
confidential, pset as psbt, secp256k1_zkp as secp256k1, sighash, OutPoint, Script, Sequence,
1111
TxIn, TxOut, Txid,
@@ -108,9 +108,9 @@ pub fn test_desc_satisfy(cl: &ElementsD, testdata: &TestData, desc: &str) -> Vec
108108
// ------------------ script spend -------------
109109
let x_only_keypairs_reqd: Vec<(secp256k1::KeyPair, TapLeafHash)> = tr
110110
.iter_scripts()
111-
.flat_map(|(_depth, ms)| {
112-
let leaf_hash = TapLeafHash::from_script(&ms.encode(), LeafVersion::default());
113-
ms.iter_pk().filter_map(move |pk| {
111+
.flat_map(|(_depth, script)| {
112+
let leaf_hash = TapLeafHash::from_script(&script.encode(), script.version());
113+
script.iter_pk().filter_map(move |pk| {
114114
let i = x_only_pks.iter().position(|&x| x.to_public_key() == pk);
115115
i.map(|idx| (xonly_keypairs[idx], leaf_hash))
116116
})

bitcoind-tests/tests/test_desc.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use std::{error, fmt};
99
use elements::hashes::{sha256d, Hash};
1010
use elements::pset::PartiallySignedTransaction as Psbt;
1111
use elements::sighash::SigHashCache;
12-
use elements::taproot::{LeafVersion, TapLeafHash};
12+
use elements::taproot::TapLeafHash;
1313
use elements::{
1414
confidential, pset as psbt, secp256k1_zkp as secp256k1, sighash, OutPoint, SchnorrSig, Script,
1515
Sequence, TxIn, TxOut, Txid,
@@ -178,9 +178,9 @@ pub fn test_desc_satisfy(
178178
// ------------------ script spend -------------
179179
let x_only_keypairs_reqd: Vec<(secp256k1::KeyPair, TapLeafHash)> = tr
180180
.iter_scripts()
181-
.flat_map(|(_depth, ms)| {
182-
let leaf_hash = TapLeafHash::from_script(&ms.encode(), LeafVersion::default());
183-
ms.iter_pk().filter_map(move |pk| {
181+
.flat_map(|(_depth, script)| {
182+
let leaf_hash = TapLeafHash::from_script(&script.encode(), script.version());
183+
script.iter_pk().filter_map(move |pk| {
184184
let i = x_only_pks.iter().position(|&x| x.to_public_key() == pk);
185185
i.map(|idx| (xonly_keypairs[idx], leaf_hash))
186186
})

bitcoind-tests/tests/test_introspect.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
66
use elements::pset::PartiallySignedTransaction as Psbt;
77
use elements::sighash::SigHashCache;
8-
use elements::taproot::{LeafVersion, TapLeafHash};
8+
use elements::taproot::TapLeafHash;
99
use elements::{
1010
confidential, pset as psbt, secp256k1_zkp as secp256k1, sighash, OutPoint, Script, Sequence,
1111
TxIn, TxOut, Txid,
@@ -107,9 +107,9 @@ pub fn test_desc_satisfy(cl: &ElementsD, testdata: &TestData, desc: &str) -> Vec
107107
// ------------------ script spend -------------
108108
let x_only_keypairs_reqd: Vec<(secp256k1::KeyPair, TapLeafHash)> = tr
109109
.iter_scripts()
110-
.flat_map(|(_depth, ms)| {
111-
let leaf_hash = TapLeafHash::from_script(&ms.encode(), LeafVersion::default());
112-
ms.iter_pk().filter_map(move |pk| {
110+
.flat_map(|(_depth, script)| {
111+
let leaf_hash = TapLeafHash::from_script(&script.encode(), script.version());
112+
script.iter_pk().filter_map(move |pk| {
113113
let i = x_only_pks.iter().position(|&x| x.to_public_key() == pk);
114114
i.map(|idx| (xonly_keypairs[idx], leaf_hash))
115115
})

0 commit comments

Comments
 (0)