Skip to content

Commit

Permalink
Implement SignMessage for descriptor wallets
Browse files Browse the repository at this point in the history
  • Loading branch information
achow101 committed Apr 23, 2020
1 parent bde7c9f commit 84b4978
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/wallet/scriptpubkeyman.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1957,7 +1957,21 @@ bool DescriptorScriptPubKeyMan::SignTransaction(CMutableTransaction& tx, const s

SigningResult DescriptorScriptPubKeyMan::SignMessage(const std::string& message, const PKHash& pkhash, std::string& str_sig) const
{
return SigningResult::SIGNING_FAILED;
std::unique_ptr<FlatSigningProvider> keys = GetSigningProvider(GetScriptForDestination(pkhash), true);
if (!keys) {
return SigningResult::PRIVATE_KEY_NOT_AVAILABLE;
}

CKeyID key_id(pkhash);
CKey key;
if (!keys->GetKey(key_id, key)) {
return SigningResult::PRIVATE_KEY_NOT_AVAILABLE;
}

if (!MessageSign(key, message, str_sig)) {
return SigningResult::SIGNING_FAILED;
}
return SigningResult::OK;
}

TransactionError DescriptorScriptPubKeyMan::FillPSBT(PartiallySignedTransaction& psbt, int sighash_type, bool sign, bool bip32derivs) const
Expand Down

0 comments on commit 84b4978

Please sign in to comment.