diff options
| author | Andrew Chow <[email protected]> | 2020-02-13 17:09:12 -0500 |
|---|---|---|
| committer | Andrew Chow <[email protected]> | 2020-03-09 11:16:20 -0400 |
| commit | 6a9c429084b40356aa36aa67992da35f61c2f6a2 (patch) | |
| tree | e2590bf410fd5c78b4e6edd5805ba99802130de6 /src/wallet/scriptpubkeyman.cpp | |
| parent | Move key and script filling and signing from CWallet::FillPSBT to ScriptPubKe... (diff) | |
| download | discoin-6a9c429084b40356aa36aa67992da35f61c2f6a2.tar.xz discoin-6a9c429084b40356aa36aa67992da35f61c2f6a2.zip | |
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.
Diffstat (limited to 'src/wallet/scriptpubkeyman.cpp')
| -rw-r--r-- | src/wallet/scriptpubkeyman.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/wallet/scriptpubkeyman.cpp b/src/wallet/scriptpubkeyman.cpp index cfb8184c3..bec4abf85 100644 --- a/src/wallet/scriptpubkeyman.cpp +++ b/src/wallet/scriptpubkeyman.cpp @@ -511,6 +511,20 @@ bool LegacyScriptPubKeyMan::SignTransaction(CMutableTransaction& tx, const std:: return ::SignTransaction(tx, this, coins, sighash, input_errors); } +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)) { + return SigningResult::PRIVATE_KEY_NOT_AVAILABLE; + } + + if (MessageSign(key, message, str_sig)) { + return SigningResult::OK; + } + return SigningResult::SIGNING_FAILED; +} + TransactionError LegacyScriptPubKeyMan::FillPSBT(PartiallySignedTransaction& psbtx, int sighash_type, bool sign, bool bip32derivs) const { for (unsigned int i = 0; i < psbtx.tx->vin.size(); ++i) { |