diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2016-03-27 12:35:36 +0100 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2016-03-27 12:37:18 +0100 |
commit | 24b3e9007a8ad0684edcee51df444b21a033e4ba (patch) | |
tree | 1cf18580df1d4e0e82038a745113bc36c7c9e305 /src/wallet/wallet_errors.h | |
parent | Merge pull request #763 (diff) | |
download | monero-24b3e9007a8ad0684edcee51df444b21a033e4ba.tar.xz |
Convey tx verification failure reasons to the RPC client
This allows appropriate action to be taken, like displaying
the reason to the user.
Do just that in simplewallet, which should help a lot in
determining why users fail to send.
Also make it so a tx which is accepted but not relayed is
seen as a success rather than a failure.
Diffstat (limited to 'src/wallet/wallet_errors.h')
-rw-r--r-- | src/wallet/wallet_errors.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/wallet/wallet_errors.h b/src/wallet/wallet_errors.h index 6074e0858..b6e583d2f 100644 --- a/src/wallet/wallet_errors.h +++ b/src/wallet/wallet_errors.h @@ -457,15 +457,17 @@ namespace tools //---------------------------------------------------------------------------------------------------- struct tx_rejected : public transfer_error { - explicit tx_rejected(std::string&& loc, const cryptonote::transaction& tx, const std::string& status) + explicit tx_rejected(std::string&& loc, const cryptonote::transaction& tx, const std::string& status, const std::string& reason) : transfer_error(std::move(loc), "transaction was rejected by daemon") , m_tx(tx) , m_status(status) + , m_reason(reason) { } const cryptonote::transaction& tx() const { return m_tx; } const std::string& status() const { return m_status; } + const std::string& reason() const { return m_reason; } std::string to_string() const { @@ -473,12 +475,17 @@ namespace tools ss << transfer_error::to_string() << ", status = " << m_status << ", tx:\n"; cryptonote::transaction tx = m_tx; ss << cryptonote::obj_to_json_str(tx); + if (!m_reason.empty()) + { + ss << " (" << m_reason << ")"; + } return ss.str(); } private: cryptonote::transaction m_tx; std::string m_status; + std::string m_reason; }; //---------------------------------------------------------------------------------------------------- struct tx_sum_overflow : public transfer_error |