mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-22 06:52:36 +01:00
Bugfix: make ToPrivateString work with x-only keys
This commit is contained in:
parent
18ad54c3b2
commit
4b2e31a7ae
1 changed files with 9 additions and 1 deletions
|
@ -259,7 +259,15 @@ public:
|
||||||
bool ToPrivateString(const SigningProvider& arg, std::string& ret) const override
|
bool ToPrivateString(const SigningProvider& arg, std::string& ret) const override
|
||||||
{
|
{
|
||||||
CKey key;
|
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);
|
ret = EncodeSecret(key);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue