Describe the bug
BDK returns an error if there are duplicated keys in different tap leaves
To Reproduce
Trying to create a wallet using the descriptor
tr(020202020202020202020202020202020202020202020202020202020202020202,{thresh(1,pk(tpubD6NzVbkrYhZ4WrjhC6iLoEYLhozBrsUjMU4poViXC57heJ8Q3EimPpoUrUKvajtkgfuPpf8Hku7X4sBazDFKqTAiSzGUaK2iCga42pcaFWe),s:pk(tpubD6NzVbkrYhZ4Y2eyqr1oFLQN1c9WUBVu9PyPxKQKnffx5wC1sumGAV9KK2zUj46oDyNCD3GHcfR9e23nFaioBfoBN9a2TtdLoSkKXw9bW1r)),and_v(v:thresh(1,pk(tpubD6NzVbkrYhZ4WrjhC6iLoEYLhozBrsUjMU4poViXC57heJ8Q3EimPpoUrUKvajtkgfuPpf8Hku7X4sBazDFKqTAiSzGUaK2iCga42pcaFWe),s:pk(tpubD6NzVbkrYhZ4Y2eyqr1oFLQN1c9WUBVu9PyPxKQKnffx5wC1sumGAV9KK2zUj46oDyNCD3GHcfR9e23nFaioBfoBN9a2TtdLoSkKXw9bW1r)),older(1))})#kgu06739
will give back Error: Descriptor(DuplicatedKeys), even tho the duplicated keys are in different tap leaves, which should be fine
The descriptor has been created like this:
let keys = [
"tpubD6NzVbkrYhZ4WrjhC6iLoEYLhozBrsUjMU4poViXC57heJ8Q3EimPpoUrUKvajtkgfuPpf8Hku7X4sBazDFKqTAiSzGUaK2iCga42pcaFWe",
"tpubD6NzVbkrYhZ4Y2eyqr1oFLQN1c9WUBVu9PyPxKQKnffx5wC1sumGAV9KK2zUj46oDyNCD3GHcfR9e23nFaioBfoBN9a2TtdLoSkKXw9bW1r",
];
let keys_joined: String = keys.into_iter().map(|k| format!("pk({})", k)).collect::<Vec<_>>().join(",");
let first_policy_str = format!("thresh({},{})", keys.len() - 1, keys_joined);
let first_policy = Concrete::<String>::from_str(&first_policy_str)?.compile()?;
let first_tap_leaf = TapTree::Leaf(Arc::new(first_policy));
let second_policy_str = format!("and(older(1),thresh({},{}))",keys.len() / 2, keys_joined);
let second_policy = Concrete::<String>::from_str(&second_policy_str)?.compile()?;
let second_tap_leaf = TapTree::Leaf(Arc::new(second_policy));
let dummy_internal = "020202020202020202020202020202020202020202020202020202020202020202".to_string();
let tap_tree = TapTree::Tree(Arc::new(first_tap_leaf), Arc::new(second_tap_leaf));
let descriptor = Descriptor::new_tr(dummy_internal, Some(tap_tree))?;
println!("{}", descriptor);
Expected behavior
The wallet is created normally
Build environment
Describe the bug
BDK returns an error if there are duplicated keys in different tap leaves
To Reproduce
Trying to create a wallet using the descriptor
will give back
Error: Descriptor(DuplicatedKeys), even tho the duplicated keys are in different tap leaves, which should be fineThe descriptor has been created like this:
Expected behavior
The wallet is created normally
Build environment