diff options
author | Riccardo Spagni <ric@spagni.net> | 2017-11-25 19:48:56 +0200 |
---|---|---|
committer | Riccardo Spagni <ric@spagni.net> | 2017-11-25 19:48:56 +0200 |
commit | 539f511eb1991423ca38ad5da8977de36cce8481 (patch) | |
tree | f4088828cf8f125f64aaa4e5f430fb23f234ad9f /src/wallet/api/wallet.cpp | |
parent | Merge pull request #2794 (diff) | |
parent | Spend proof without txkey (diff) | |
download | monero-539f511eb1991423ca38ad5da8977de36cce8481.tar.xz |
Merge pull request #2368
b0b7e0f0 Spend proof without txkey (stoffu)
Diffstat (limited to 'src/wallet/api/wallet.cpp')
-rw-r--r-- | src/wallet/api/wallet.cpp | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/wallet/api/wallet.cpp b/src/wallet/api/wallet.cpp index b14c2e1eb..fd0b65866 100644 --- a/src/wallet/api/wallet.cpp +++ b/src/wallet/api/wallet.cpp @@ -1530,6 +1530,52 @@ bool WalletImpl::checkTxProof(const std::string &txid_str, const std::string &ad } } +std::string WalletImpl::getSpendProof(const std::string &txid_str, const std::string &message) const { + crypto::hash txid; + if(!epee::string_tools::hex_to_pod(txid_str, txid)) + { + m_status = Status_Error; + m_errorString = tr("Failed to parse txid"); + return ""; + } + + try + { + m_status = Status_Ok; + return m_wallet->get_spend_proof(txid, message); + } + catch (const std::exception &e) + { + m_status = Status_Error; + m_errorString = e.what(); + return ""; + } +} + +bool WalletImpl::checkSpendProof(const std::string &txid_str, const std::string &message, const std::string &signature, bool &good) const { + good = false; + crypto::hash txid; + if(!epee::string_tools::hex_to_pod(txid_str, txid)) + { + m_status = Status_Error; + m_errorString = tr("Failed to parse txid"); + return false; + } + + try + { + m_status = Status_Ok; + good = m_wallet->check_spend_proof(txid, message, signature); + return true; + } + catch (const std::exception &e) + { + m_status = Status_Error; + m_errorString = e.what(); + return false; + } +} + std::string WalletImpl::signMessage(const std::string &message) { return m_wallet->sign(message); |