P2TR was missing in m_pubkey_args description and it was a typo in doc/descriptors.md
P2TR was missing in m_pubkey_args description and it was a typo in doc/descriptors.md
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/33384.
See the guideline for information on the review process. A summary of reviews will appear here.
Possible typos and grammar issues:
No other typos were found.
drahtbot_id_5_m
792@@ -793,13 +793,13 @@ class MuSigPubkeyProvider final : public PubkeyProvider
793 class DescriptorImpl : public Descriptor
794 {
795 protected:
796- //! Public key arguments for this descriptor (size 1 for PK, PKH, WPKH; any size for WSH and Multisig).
797+ //! Public key arguments for this descriptor (size 1 for PK, PKH, WPKH; any size for WSH, P2TR, Multisig).
This doesn’t seem to be correct. I debugged the unit tests & the listdescriptors RPC, and found that m_pubkey_args.size() remains 1 for tr() descriptors as well. It’s the m_subdescriptor_args.size() that increases if script path(s) is(are) present. Following points support this:
TRDescriptor constructor accepts a single PubkeyProvider that’s treated as the Taproot internal key: https://github.com/bitcoin/bitcoin/blob/5c5704e730796c6f31e2d7891bf6334674a04219/src/script/descriptor.cpp#L1407-L1408Make DescriptorImpl support multiple subscripts So far, no descriptor exists that supports more than one sub-script descriptor. This will change with taproot, so prepare for this by changing the m_subdescriptor_arg from a unique_ptr to a vector of unique_ptr’s.
+1 to what @rkrux found.
Checked the code as well and m_pubkey_args.size() remains 1 for TR descriptors. The internal key is passed via Vector(std::move(internal_key)), which constructs a single-element vector.
I would suggest updating the comment to:
0//! Public key arguments for this descriptor (size 1 for PK, PKH, WPKH, TR; any size for Multisig).
Also, it looks like the only real “any size” case for m_pubkey_args is multisig, since it is the one that passes a vector of multiple providers directly into DescriptorImpl.
0MultisigDescriptor(int threshold,
1 std::vector<std::unique_ptr<PubkeyProvider>> providers,
2 bool sorted = false)
3 : DescriptorImpl(std::move(providers), sorted ? "sortedmulti" : "multi"),
4 m_threshold(threshold), m_sorted(sorted) {}
SHDescriptor don’t populate m_pubkey_args at all, it initializes it as an empty vector and stores the wrapped descriptor under m_subdescriptor_args:
0SHDescriptor(std::unique_ptr<DescriptorImpl> desc)
1 : DescriptorImpl({}, std::move(desc), "sh") {}
It might be worth updating the m_subdescriptor_args comment:
As TRDescriptors are using m_subdescriptor_args.