1
0
Fork 0
forked from lthn/blockchain

wallet rpc: check for fee correctness on "transfer" call prior to tx creation

This commit is contained in:
sowle 2020-07-21 14:32:56 +03:00
parent 61d95846ae
commit 50abfc82aa
No known key found for this signature in database
GPG key ID: C07A24B2D89D49FC

View file

@ -239,6 +239,13 @@ namespace tools
//------------------------------------------------------------------------------------------------------------------------------
bool wallet_rpc_server::on_transfer(const wallet_public::COMMAND_RPC_TRANSFER::request& req, wallet_public::COMMAND_RPC_TRANSFER::response& res, epee::json_rpc::error& er, connection_context& cntx)
{
if (req.fee < m_wallet.get_core_runtime_config().tx_pool_min_fee)
{
er.code = WALLET_RPC_ERROR_CODE_WRONG_ARGUMENT;
er.message = std::string("Given fee is too low: ") + epee::string_tools::num_to_string_fast(req.fee) + ", minimum is: " + epee::string_tools::num_to_string_fast(m_wallet.get_core_runtime_config().tx_pool_min_fee);
return false;
}
std::string payment_id;
if (!epee::string_tools::parse_hexstr_to_binbuff(req.payment_id, payment_id))
{