From c036b0db6f199373e15b7cd0498ecca0ebd5af00 Mon Sep 17 00:00:00 2001 From: Dr Maxim Orlovsky Date: Tue, 5 Apr 2022 22:43:52 +0200 Subject: [PATCH] Unit test for failing TapTree on builder containing hidden nodes. --- src/util/psbt/serialize.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/util/psbt/serialize.rs b/src/util/psbt/serialize.rs index 589b4193..438693f9 100644 --- a/src/util/psbt/serialize.rs +++ b/src/util/psbt/serialize.rs @@ -388,6 +388,14 @@ mod tests { builder } + #[test] + fn taptree_hidden() { + let mut builder = compose_taproot_builder(0x51, &[2, 2, 2]); + builder = builder.add_leaf_with_ver(3, Script::from_hex("b9").unwrap(), LeafVersion::from_consensus(0xC2).unwrap()).unwrap(); + builder = builder.add_hidden_node(3, sha256::Hash::default()).unwrap(); + assert!(TapTree::from_inner(builder.clone()).is_err()); + } + #[test] fn taptree_roundtrip() { let mut builder = compose_taproot_builder(0x51, &[2, 2, 2, 3]);