Unit test for failing TapTree on builder containing hidden nodes.

This commit is contained in:
Dr Maxim Orlovsky 2022-04-05 22:43:52 +02:00
parent 77715311cf
commit c036b0db6f
No known key found for this signature in database
GPG Key ID: FFC0250947E5C6F7
1 changed files with 8 additions and 0 deletions

View File

@ -388,6 +388,14 @@ mod tests {
builder 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] #[test]
fn taptree_roundtrip() { fn taptree_roundtrip() {
let mut builder = compose_taproot_builder(0x51, &[2, 2, 2, 3]); let mut builder = compose_taproot_builder(0x51, &[2, 2, 2, 3]);