aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/wallet_errors.h
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2019-03-17 17:55:12 +0200
committerRiccardo Spagni <ric@spagni.net>2019-03-17 17:55:13 +0200
commite1be617ea2022459c6df9dc4d8b331cc249cae0a (patch)
tree0bcd62d1972fa9cda1379807eb507c1a74b619c3 /src/wallet/wallet_errors.h
parentMerge pull request #5181 (diff)
parentBetter error when sending a tx with a too large extra field (diff)
downloadmonero-e1be617ea2022459c6df9dc4d8b331cc249cae0a.tar.xz
Merge pull request #5182
b674728d Better error when sending a tx with a too large extra field (moneromooo-monero)
Diffstat (limited to 'src/wallet/wallet_errors.h')
-rw-r--r--src/wallet/wallet_errors.h23
1 files changed, 20 insertions, 3 deletions
diff --git a/src/wallet/wallet_errors.h b/src/wallet/wallet_errors.h
index f486e5f2f..6ebaaa395 100644
--- a/src/wallet/wallet_errors.h
+++ b/src/wallet/wallet_errors.h
@@ -699,26 +699,43 @@ namespace tools
explicit tx_too_big(std::string&& loc, const cryptonote::transaction& tx, uint64_t tx_weight_limit)
: transfer_error(std::move(loc), "transaction is too big")
, m_tx(tx)
+ , m_tx_valid(true)
+ , m_tx_weight(cryptonote::get_transaction_weight(tx))
, m_tx_weight_limit(tx_weight_limit)
{
}
+ explicit tx_too_big(std::string&& loc, uint64_t tx_weight, uint64_t tx_weight_limit)
+ : transfer_error(std::move(loc), "transaction would be too big")
+ , m_tx_valid(false)
+ , m_tx_weight(tx_weight)
+ , m_tx_weight_limit(tx_weight_limit)
+ {
+ }
+
+ bool tx_valid() const { return m_tx_valid; }
const cryptonote::transaction& tx() const { return m_tx; }
+ uint64_t tx_weight() const { return m_tx_weight; }
uint64_t tx_weight_limit() const { return m_tx_weight_limit; }
std::string to_string() const
{
std::ostringstream ss;
- cryptonote::transaction tx = m_tx;
ss << transfer_error::to_string() <<
", tx_weight_limit = " << m_tx_weight_limit <<
- ", tx weight = " << get_transaction_weight(m_tx) <<
- ", tx:\n" << cryptonote::obj_to_json_str(tx);
+ ", tx weight = " << m_tx_weight;
+ if (m_tx_valid)
+ {
+ cryptonote::transaction tx = m_tx;
+ ss << ", tx:\n" << cryptonote::obj_to_json_str(tx);
+ }
return ss.str();
}
private:
cryptonote::transaction m_tx;
+ bool m_tx_valid;
+ uint64_t m_tx_weight;
uint64_t m_tx_weight_limit;
};
//----------------------------------------------------------------------------------------------------