taproot-tests: validate tap_tree in psbt outputs

Co-authored-by: Daniela Brozzoni <danielabrozzoni@protonmail.com>
This commit is contained in:
Alekos Filini 2022-05-31 17:47:26 +02:00
parent c1bfaf9b1e
commit 5320c8353e
No known key found for this signature in database
GPG Key ID: 431401E4A4530061

View File

@ -4289,6 +4289,8 @@ pub(crate) mod test {
#[test] #[test]
fn test_taproot_psbt_input_tap_tree() { fn test_taproot_psbt_input_tap_tree() {
use crate::bitcoin::psbt::serialize::Deserialize;
use crate::bitcoin::psbt::TapTree;
use bitcoin::hashes::hex::FromHex; use bitcoin::hashes::hex::FromHex;
use bitcoin::util::taproot; use bitcoin::util::taproot;
@ -4328,6 +4330,11 @@ pub(crate) mod test {
psbt.inputs[0].tap_internal_key, psbt.inputs[0].tap_internal_key,
psbt.outputs[0].tap_internal_key psbt.outputs[0].tap_internal_key
); );
assert_eq!(
psbt.outputs[0].tap_tree,
Some(TapTree::deserialize(&Vec::<u8>::from_hex("01c022208aee2b8120a5f157f1223f72b5e62b825831a27a9fdf427db7cc697494d4a642ac01c0222051494dc22e24a32fe9dcfbd7e85faf345fa1df296fb49d156e859ef345201295ac",).unwrap()).unwrap())
);
} }
#[test] #[test]