Use explicit conversion from PKHash -> CKeyID

These types are equivalent, in data etc, so they need only their
data cast across.

Note a function is used rather than a casting
operator as CKeyID is defined at a lower level than script/standard
This commit is contained in:
Ben Woosley
2020-01-15 13:40:14 -08:00
parent a9e451f144
commit 2c54217f91
6 changed files with 11 additions and 7 deletions

View File

@@ -573,9 +573,8 @@ bool LegacyScriptPubKeyMan::SignTransaction(CMutableTransaction& tx, const std::
SigningResult LegacyScriptPubKeyMan::SignMessage(const std::string& message, const PKHash& pkhash, std::string& str_sig) const
{
CKeyID key_id(pkhash);
CKey key;
if (!GetKey(key_id, key)) {
if (!GetKey(ToKeyID(pkhash), key)) {
return SigningResult::PRIVATE_KEY_NOT_AVAILABLE;
}
@@ -2052,9 +2051,8 @@ SigningResult DescriptorScriptPubKeyMan::SignMessage(const std::string& message,
return SigningResult::PRIVATE_KEY_NOT_AVAILABLE;
}
CKeyID key_id(pkhash);
CKey key;
if (!keys->GetKey(key_id, key)) {
if (!keys->GetKey(ToKeyID(pkhash), key)) {
return SigningResult::PRIVATE_KEY_NOT_AVAILABLE;
}