Skip to content

Remove redundant duplicated keys check#761

Merged
danielabrozzoni merged 1 commit intobitcoindevkit:masterfrom
afilini:fix/duplicated-keys-taproot
Sep 26, 2022
Merged

Remove redundant duplicated keys check#761
danielabrozzoni merged 1 commit intobitcoindevkit:masterfrom
afilini:fix/duplicated-keys-taproot

Conversation

@afilini
Copy link
Copy Markdown
Member

@afilini afilini commented Sep 24, 2022

Description

This check is redundant since it's already performed by miniscript (see https://docs.rs/miniscript/7.0.0/miniscript/miniscript/analyzable/enum.AnalysisError.html#variant.RepeatedPubkeys) and it was incorrectly failing on tr descriptors that contain duplicated keys across different taproot leaves

Fixes #760

Changelog notice

Checklists

All Submissions:

  • I've signed all my commits
  • I followed the contribution guidelines
  • I ran cargo fmt and cargo clippy before committing

Bugfixes:

  • This pull request breaks the existing API
  • I've added tests to reproduce the issue which are now passing
  • I'm linking the issue being fixed by this PR

This check is redundant since it's already performed by miniscript (see
https://docs.rs/miniscript/7.0.0/miniscript/miniscript/analyzable/enum.AnalysisError.html#variant.RepeatedPubkeys)
and it was incorrectly failing on tr descriptors that contain duplicated
keys across different taproot leaves

Fixes bitcoindevkit#760
Comment thread src/wallet/mod.rs
"tr(cNJmN3fH9DDbDt131fQNkVakkpzawJBSeybCUNmP1BovpmGQ45xG,{pk(tprv8ZgxMBicQKsPdDArR4xSAECuVxeX1jwwSXR4ApKbkYgZiziDc4LdBy2WvJeGDfUSE4UT4hHhbgEwbdq8ajjUHiKDegkwrNU6V55CxcxonVN/*),pk(8aee2b8120a5f157f1223f72b5e62b825831a27a9fdf427db7cc697494d4a642)})"
}

pub(crate) fn get_test_tr_dup_keys() -> &'static str {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this string just be added to test_taproot_load_descriptor_duplicated_keys or do you anticipate using this descriptor in other tests?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it could be used in other tests, for example if we want to see how the policy module deals with duplicated keys

Copy link
Copy Markdown
Member

@danielabrozzoni danielabrozzoni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review ACK e2bf973 - the code looks good to me, but I didn't test manually

@danielabrozzoni danielabrozzoni merged commit dbf6bf5 into bitcoindevkit:master Sep 26, 2022
@afilini afilini deleted the fix/duplicated-keys-taproot branch September 29, 2022 21:32
@afilini afilini mentioned this pull request Oct 7, 2022
24 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BDK shouldn't complain if there are duplicated keys in TapLeaves

3 participants