Skip to content

Commit 84b4978

Browse files
committed
Implement SignMessage for descriptor wallets
1 parent bde7c9f commit 84b4978

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

src/wallet/scriptpubkeyman.cpp

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1957,7 +1957,21 @@ bool DescriptorScriptPubKeyMan::SignTransaction(CMutableTransaction& tx, const s
19571957

19581958
SigningResult DescriptorScriptPubKeyMan::SignMessage(const std::string& message, const PKHash& pkhash, std::string& str_sig) const
19591959
{
1960-
return SigningResult::SIGNING_FAILED;
1960+
std::unique_ptr<FlatSigningProvider> keys = GetSigningProvider(GetScriptForDestination(pkhash), true);
1961+
if (!keys) {
1962+
return SigningResult::PRIVATE_KEY_NOT_AVAILABLE;
1963+
}
1964+
1965+
CKeyID key_id(pkhash);
1966+
CKey key;
1967+
if (!keys->GetKey(key_id, key)) {
1968+
return SigningResult::PRIVATE_KEY_NOT_AVAILABLE;
1969+
}
1970+
1971+
if (!MessageSign(key, message, str_sig)) {
1972+
return SigningResult::SIGNING_FAILED;
1973+
}
1974+
return SigningResult::OK;
19611975
}
19621976

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

0 commit comments

Comments
 (0)