Bugfix: make ToPrivateString work with x-only keys

pull/24343/head
Pieter Wuille 3 years ago
parent 18ad54c3b2
commit 4b2e31a7ae

@ -259,7 +259,15 @@ public:
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;
}

Loading…
Cancel
Save