forked from such-gitea/wownero-lws
Return lws::error::not_enough_amount when received is less than requested amount (#154)
This commit is contained in:
committed by
Lee *!* Clagett
parent
450fc0b2cc
commit
4e85e3c828
@@ -95,6 +95,8 @@ namespace lws
|
|||||||
return "Max subaddresses exceeded";
|
return "Max subaddresses exceeded";
|
||||||
case error::not_enough_mixin:
|
case error::not_enough_mixin:
|
||||||
return "Not enough outputs to meet requested mixin count";
|
return "Not enough outputs to meet requested mixin count";
|
||||||
|
case error::not_enough_amount:
|
||||||
|
return "Not enough outputs to meet requested amount";
|
||||||
case error::signal_abort_process:
|
case error::signal_abort_process:
|
||||||
return "An in-process message was received to abort the process";
|
return "An in-process message was received to abort the process";
|
||||||
case error::signal_abort_scan:
|
case error::signal_abort_scan:
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ namespace lws
|
|||||||
json_rpc, //!< Error returned by JSON-RPC server
|
json_rpc, //!< Error returned by JSON-RPC server
|
||||||
max_subaddresses, //!< Max subaddresses exceeded
|
max_subaddresses, //!< Max subaddresses exceeded
|
||||||
not_enough_mixin, //!< Not enough outputs to meet mixin count
|
not_enough_mixin, //!< Not enough outputs to meet mixin count
|
||||||
|
not_enough_amount, //!< Not enough outputs to meet amount
|
||||||
signal_abort_process, //!< In process ZMQ PUB to abort the process was received
|
signal_abort_process, //!< In process ZMQ PUB to abort the process was received
|
||||||
signal_abort_scan, //!< In process ZMQ PUB to abort the scan was received
|
signal_abort_scan, //!< In process ZMQ PUB to abort the scan was received
|
||||||
signal_unknown, //!< An unknown in process ZMQ PUB was received
|
signal_unknown, //!< An unknown in process ZMQ PUB was received
|
||||||
|
|||||||
@@ -1063,7 +1063,7 @@ namespace lws
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (received < std::uint64_t(req.amount))
|
if (received < std::uint64_t(req.amount))
|
||||||
return {lws::error::account_not_found};
|
return {lws::error::not_enough_amount};
|
||||||
|
|
||||||
if (rpc->size_scale == 0 || 1024 < rpc->size_scale || rpc->fee_mask == 0)
|
if (rpc->size_scale == 0 || 1024 < rpc->size_scale || rpc->fee_mask == 0)
|
||||||
return {lws::error::bad_daemon_response};
|
return {lws::error::bad_daemon_response};
|
||||||
@@ -1964,7 +1964,7 @@ namespace lws
|
|||||||
MINFO("REST error: " << error.message() << " from " << sock().remote_endpoint(ec) << " / " << this);
|
MINFO("REST error: " << error.message() << " from " << sock().remote_endpoint(ec) << " / " << this);
|
||||||
|
|
||||||
assert(strand_.running_in_this_thread());
|
assert(strand_.running_in_this_thread());
|
||||||
if (error.category() == wire::error::rapidjson_category() || error == lws::error::invalid_range)
|
if (error.category() == wire::error::rapidjson_category() || error == lws::error::invalid_range || error == lws::error::not_enough_amount)
|
||||||
return bad_request(boost::beast::http::status::bad_request, std::forward<F>(resume));
|
return bad_request(boost::beast::http::status::bad_request, std::forward<F>(resume));
|
||||||
else if (error == lws::error::account_not_found || error == lws::error::duplicate_request)
|
else if (error == lws::error::account_not_found || error == lws::error::duplicate_request)
|
||||||
return bad_request(boost::beast::http::status::forbidden, std::forward<F>(resume));
|
return bad_request(boost::beast::http::status::forbidden, std::forward<F>(resume));
|
||||||
|
|||||||
Reference in New Issue
Block a user