aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/api/wallet.cpp
diff options
context:
space:
mode:
authorluigi1111 <luigi1111w@gmail.com>2019-08-15 17:21:26 -0500
committerluigi1111 <luigi1111w@gmail.com>2019-08-15 17:21:26 -0500
commit6b6593dad9b91354b1a573eafbe069c54d961c4d (patch)
tree8ef3df3815ac247aa71467099fc01d88e022bd85 /src/wallet/api/wallet.cpp
parentMerge pull request #5672 (diff)
parentwallet_api: catch getTxKey exception (diff)
downloadmonero-6b6593dad9b91354b1a573eafbe069c54d961c4d.tar.xz
Merge pull request #5673
097cca5 wallet_api: catch getTxKey exception (ph4r05)
Diffstat (limited to 'src/wallet/api/wallet.cpp')
-rw-r--r--src/wallet/api/wallet.cpp25
1 files changed, 17 insertions, 8 deletions
diff --git a/src/wallet/api/wallet.cpp b/src/wallet/api/wallet.cpp
index 140261f0b..fa67b103e 100644
--- a/src/wallet/api/wallet.cpp
+++ b/src/wallet/api/wallet.cpp
@@ -1742,18 +1742,27 @@ std::string WalletImpl::getTxKey(const std::string &txid_str) const
crypto::secret_key tx_key;
std::vector<crypto::secret_key> additional_tx_keys;
- if (m_wallet->get_tx_key(txid, tx_key, additional_tx_keys))
+ try
{
clearStatus();
- std::ostringstream oss;
- oss << epee::string_tools::pod_to_hex(tx_key);
- for (size_t i = 0; i < additional_tx_keys.size(); ++i)
- oss << epee::string_tools::pod_to_hex(additional_tx_keys[i]);
- return oss.str();
+ if (m_wallet->get_tx_key(txid, tx_key, additional_tx_keys))
+ {
+ clearStatus();
+ std::ostringstream oss;
+ oss << epee::string_tools::pod_to_hex(tx_key);
+ for (size_t i = 0; i < additional_tx_keys.size(); ++i)
+ oss << epee::string_tools::pod_to_hex(additional_tx_keys[i]);
+ return oss.str();
+ }
+ else
+ {
+ setStatusError(tr("no tx keys found for this txid"));
+ return "";
+ }
}
- else
+ catch (const std::exception &e)
{
- setStatusError(tr("no tx keys found for this txid"));
+ setStatusError(e.what());
return "";
}
}