mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-01 16:53:52 +02:00
Move direct calls to MessageSign into new SignMessage functions in CWallet and ScriptPubKeyMan
Instead of getting a SigningProvider and then going to MessageSign, have ScriptPubKeyMan handle the message signing internally.
This commit is contained in:
@@ -76,3 +76,17 @@ uint256 MessageHash(const std::string& message)
|
||||
|
||||
return hasher.GetHash();
|
||||
}
|
||||
|
||||
std::string SigningResultString(const SigningResult res)
|
||||
{
|
||||
switch (res) {
|
||||
case SigningResult::OK:
|
||||
return "No error";
|
||||
case SigningResult::PRIVATE_KEY_NOT_AVAILABLE:
|
||||
return "Private key not available";
|
||||
case SigningResult::SIGNING_FAILED:
|
||||
return "Sign failed";
|
||||
// no default case, so the compiler can warn about missing cases
|
||||
}
|
||||
assert(false);
|
||||
}
|
||||
|
||||
@@ -39,6 +39,12 @@ enum class MessageVerificationResult {
|
||||
OK
|
||||
};
|
||||
|
||||
enum class SigningResult {
|
||||
OK, //!< No error
|
||||
PRIVATE_KEY_NOT_AVAILABLE,
|
||||
SIGNING_FAILED,
|
||||
};
|
||||
|
||||
/** Verify a signed message.
|
||||
* @param[in] address Signer's bitcoin address, it must refer to a public key.
|
||||
* @param[in] signature The signature in base64 format.
|
||||
@@ -65,4 +71,6 @@ bool MessageSign(
|
||||
*/
|
||||
uint256 MessageHash(const std::string& message);
|
||||
|
||||
std::string SigningResultString(const SigningResult res);
|
||||
|
||||
#endif // BITCOIN_UTIL_MESSAGE_H
|
||||
|
||||
Reference in New Issue
Block a user