wallet_api: catch getTxKey exception

- getTxKey method throws an exception, e.g., when user declines txKey export
This commit is contained in:
Dusan Klinec 2019-06-19 12:07:50 +02:00
parent 6335509727
commit 097cca59c1
No known key found for this signature in database
GPG Key ID: 6337E118CCBCE103

View File

@ -1729,6 +1729,9 @@ std::string WalletImpl::getTxKey(const std::string &txid_str) const
crypto::secret_key tx_key; crypto::secret_key tx_key;
std::vector<crypto::secret_key> additional_tx_keys; std::vector<crypto::secret_key> additional_tx_keys;
try
{
clearStatus();
if (m_wallet->get_tx_key(txid, tx_key, additional_tx_keys)) if (m_wallet->get_tx_key(txid, tx_key, additional_tx_keys))
{ {
clearStatus(); clearStatus();
@ -1743,6 +1746,12 @@ std::string WalletImpl::getTxKey(const std::string &txid_str) const
setStatusError(tr("no tx keys found for this txid")); setStatusError(tr("no tx keys found for this txid"));
return ""; return "";
} }
}
catch (const std::exception &e)
{
setStatusError(e.what());
return "";
}
} }
bool WalletImpl::checkTxKey(const std::string &txid_str, std::string tx_key_str, const std::string &address_str, uint64_t &received, bool &in_pool, uint64_t &confirmations) bool WalletImpl::checkTxKey(const std::string &txid_str, std::string tx_key_str, const std::string &address_str, uint64_t &received, bool &in_pool, uint64_t &confirmations)