Return lws::error::not_enough_amount when received is less than requested amount (#154)

This commit is contained in:
everoddandeven
2025-04-19 05:20:00 +02:00
committed by Lee *!* Clagett
parent 450fc0b2cc
commit 4e85e3c828
3 changed files with 5 additions and 2 deletions

View File

@@ -1063,7 +1063,7 @@ namespace lws
}
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)
return {lws::error::bad_daemon_response};
@@ -1964,7 +1964,7 @@ namespace lws
MINFO("REST error: " << error.message() << " from " << sock().remote_endpoint(ec) << " / " << this);
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));
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));