Skip to content

Commit

Permalink
Merge 72f9728 into merged_master (Bitcoin PR bitcoin/bitcoin#24343)
Browse files Browse the repository at this point in the history
Had to change some hashes in descriptor_tests, presumably because of the
differences between when Elements and Bitcoin when it comes to Taproot.

Please review this carefully and investigate the FIXME
  • Loading branch information
delta1 committed Jul 2, 2023
2 parents 5ec7209 + 72f9728 commit eef2269
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 15 deletions.
12 changes: 10 additions & 2 deletions src/script/descriptor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,15 @@ class ConstPubkeyProvider final : public PubkeyProvider
bool ToPrivateString(const SigningProvider& arg, std::string& ret) const override
{
CKey key;
if (!arg.GetKey(m_pubkey.GetID(), key)) return false;
if (m_xonly) {
for (const auto& keyid : XOnlyPubKey(m_pubkey).GetKeyIDs()) {
arg.GetKey(keyid, key);
if (key.IsValid()) break;
}
} else {
arg.GetKey(m_pubkey.GetID(), key);
}
if (!key.IsValid()) return false;
ret = EncodeSecret(key);
return true;
}
Expand Down Expand Up @@ -1253,7 +1261,7 @@ std::unique_ptr<DescriptorImpl> InferScript(const CScript& script, ParseScriptCo
{
if (ctx == ParseScriptContext::P2TR && script.size() == 34 && script[0] == 32 && script[33] == OP_CHECKSIG) {
XOnlyPubKey key{Span{script}.subspan(1, 32)};
return std::make_unique<PKDescriptor>(InferXOnlyPubkey(key, ctx, provider));
return std::make_unique<PKDescriptor>(InferXOnlyPubkey(key, ctx, provider), true);
}

std::vector<std::vector<unsigned char>> data;
Expand Down

0 comments on commit eef2269

Please sign in to comment.