diff --git a/src/wallet/wallet_rpc_server.cpp b/src/wallet/wallet_rpc_server.cpp index 8aa779fa0..99d171b8d 100644 --- a/src/wallet/wallet_rpc_server.cpp +++ b/src/wallet/wallet_rpc_server.cpp @@ -1095,11 +1095,11 @@ namespace tools return false; } - // reject proposed transactions if there are more than one. see on_transfer_split below. + // reject proposed transactions if there are more than one. if (ptx_vector.size() != 1) { er.code = WALLET_RPC_ERROR_CODE_TX_TOO_LARGE; - er.message = "Transaction would be too large. try /transfer_split."; + er.message = "Transaction would be too large."; return false; } @@ -1114,54 +1114,6 @@ namespace tools return true; } //------------------------------------------------------------------------------------------------------------------------------ - bool wallet_rpc_server::on_transfer_split(const wallet_rpc::COMMAND_RPC_TRANSFER_SPLIT::request& req, wallet_rpc::COMMAND_RPC_TRANSFER_SPLIT::response& res, epee::json_rpc::error& er, const connection_context *ctx) - { - - std::vector dsts; - std::vector extra; - - if (!m_wallet) return not_open(er); - if (m_restricted) - { - er.code = WALLET_RPC_ERROR_CODE_DENIED; - er.message = "Command unavailable in restricted mode."; - return false; - } - - CHECK_MULTISIG_ENABLED(); - - // validate the transfer requested and populate dsts & extra; RPC_TRANSFER::request and RPC_TRANSFER_SPLIT::request are identical types. - if (!validate_transfer(req.destinations, req.payment_id, dsts, extra, true, er)) - { - return false; - } - - try - { - uint64_t mixin = m_wallet->adjust_mixin(req.ring_size ? req.ring_size - 1 : 0); - uint32_t priority = m_wallet->adjust_priority(req.priority); - LOG_PRINT_L2("on_transfer_split calling create_transactions_2"); - std::vector ptx_vector = m_wallet->create_transactions_2(dsts, mixin, req.unlock_time, priority, extra, req.account_index, req.subaddr_indices); - LOG_PRINT_L2("on_transfer_split called create_transactions_2"); - - if (ptx_vector.empty()) - { - er.code = WALLET_RPC_ERROR_CODE_TX_NOT_POSSIBLE; - er.message = "No transaction created"; - return false; - } - - return fill_response(ptx_vector, req.get_tx_keys, res.tx_key_list, res.amount_list, res.fee_list, res.weight_list, res.multisig_txset, res.unsigned_txset, req.do_not_relay, - res.tx_hash_list, req.get_tx_hex, res.tx_blob_list, req.get_tx_metadata, res.tx_metadata_list, res.spent_key_images_list, er); - } - catch (const std::exception& e) - { - handle_rpc_exception(std::current_exception(), er, WALLET_RPC_ERROR_CODE_GENERIC_TRANSFER_ERROR); - return false; - } - return true; - } - //------------------------------------------------------------------------------------------------------------------------------ bool wallet_rpc_server::on_sign_transfer(const wallet_rpc::COMMAND_RPC_SIGN_TRANSFER::request& req, wallet_rpc::COMMAND_RPC_SIGN_TRANSFER::response& res, epee::json_rpc::error& er, const connection_context *ctx) { if (!m_wallet) return not_open(er); diff --git a/src/wallet/wallet_rpc_server.h b/src/wallet/wallet_rpc_server.h index 3088fd9c2..57c1286f3 100644 --- a/src/wallet/wallet_rpc_server.h +++ b/src/wallet/wallet_rpc_server.h @@ -88,7 +88,6 @@ namespace tools MAP_JON_RPC_WE("thaw", on_thaw, wallet_rpc::COMMAND_RPC_THAW) MAP_JON_RPC_WE("frozen", on_frozen, wallet_rpc::COMMAND_RPC_FROZEN) MAP_JON_RPC_WE("transfer", on_transfer, wallet_rpc::COMMAND_RPC_TRANSFER) - MAP_JON_RPC_WE("transfer_split", on_transfer_split, wallet_rpc::COMMAND_RPC_TRANSFER_SPLIT) MAP_JON_RPC_WE("sign_transfer", on_sign_transfer, wallet_rpc::COMMAND_RPC_SIGN_TRANSFER) MAP_JON_RPC_WE("describe_transfer", on_describe_transfer, wallet_rpc::COMMAND_RPC_DESCRIBE_TRANSFER) MAP_JON_RPC_WE("submit_transfer", on_submit_transfer, wallet_rpc::COMMAND_RPC_SUBMIT_TRANSFER) @@ -181,7 +180,6 @@ namespace tools bool on_thaw(const wallet_rpc::COMMAND_RPC_THAW::request& req, wallet_rpc::COMMAND_RPC_THAW::response& res, epee::json_rpc::error& er, const connection_context *ctx = NULL); bool on_frozen(const wallet_rpc::COMMAND_RPC_FROZEN::request& req, wallet_rpc::COMMAND_RPC_FROZEN::response& res, epee::json_rpc::error& er, const connection_context *ctx = NULL); bool on_transfer(const wallet_rpc::COMMAND_RPC_TRANSFER::request& req, wallet_rpc::COMMAND_RPC_TRANSFER::response& res, epee::json_rpc::error& er, const connection_context *ctx = NULL); - bool on_transfer_split(const wallet_rpc::COMMAND_RPC_TRANSFER_SPLIT::request& req, wallet_rpc::COMMAND_RPC_TRANSFER_SPLIT::response& res, epee::json_rpc::error& er, const connection_context *ctx = NULL); bool on_sign_transfer(const wallet_rpc::COMMAND_RPC_SIGN_TRANSFER::request& req, wallet_rpc::COMMAND_RPC_SIGN_TRANSFER::response& res, epee::json_rpc::error& er, const connection_context *ctx = NULL); bool on_describe_transfer(const wallet_rpc::COMMAND_RPC_DESCRIBE_TRANSFER::request& req, wallet_rpc::COMMAND_RPC_DESCRIBE_TRANSFER::response& res, epee::json_rpc::error& er, const connection_context *ctx = NULL); bool on_submit_transfer(const wallet_rpc::COMMAND_RPC_SUBMIT_TRANSFER::request& req, wallet_rpc::COMMAND_RPC_SUBMIT_TRANSFER::response& res, epee::json_rpc::error& er, const connection_context *ctx = NULL); diff --git a/src/wallet/wallet_rpc_server_commands_defs.h b/src/wallet/wallet_rpc_server_commands_defs.h index 60df6296f..1a3a687dc 100644 --- a/src/wallet/wallet_rpc_server_commands_defs.h +++ b/src/wallet/wallet_rpc_server_commands_defs.h @@ -591,76 +591,6 @@ namespace wallet_rpc typedef epee::misc_utils::struct_init response; }; - struct COMMAND_RPC_TRANSFER_SPLIT - { - struct request_t - { - std::list destinations; - uint32_t account_index; - std::set subaddr_indices; - uint32_t priority; - uint64_t ring_size; - uint64_t unlock_time; - std::string payment_id; - bool get_tx_keys; - bool do_not_relay; - bool get_tx_hex; - bool get_tx_metadata; - - BEGIN_KV_SERIALIZE_MAP() - KV_SERIALIZE(destinations) - KV_SERIALIZE(account_index) - KV_SERIALIZE(subaddr_indices) - KV_SERIALIZE(priority) - KV_SERIALIZE_OPT(ring_size, (uint64_t)0) - KV_SERIALIZE(unlock_time) - KV_SERIALIZE(payment_id) - KV_SERIALIZE(get_tx_keys) - KV_SERIALIZE_OPT(do_not_relay, false) - KV_SERIALIZE_OPT(get_tx_hex, false) - KV_SERIALIZE_OPT(get_tx_metadata, false) - END_KV_SERIALIZE_MAP() - }; - typedef epee::misc_utils::struct_init request; - - struct key_list - { - std::list keys; - - BEGIN_KV_SERIALIZE_MAP() - KV_SERIALIZE(keys) - END_KV_SERIALIZE_MAP() - }; - - struct response_t - { - std::list tx_hash_list; - std::list tx_key_list; - std::list amount_list; - std::list fee_list; - std::list weight_list; - std::list tx_blob_list; - std::list tx_metadata_list; - std::string multisig_txset; - std::string unsigned_txset; - std::list spent_key_images_list; - - BEGIN_KV_SERIALIZE_MAP() - KV_SERIALIZE(tx_hash_list) - KV_SERIALIZE(tx_key_list) - KV_SERIALIZE(amount_list) - KV_SERIALIZE(fee_list) - KV_SERIALIZE(weight_list) - KV_SERIALIZE(tx_blob_list) - KV_SERIALIZE(tx_metadata_list) - KV_SERIALIZE(multisig_txset) - KV_SERIALIZE(unsigned_txset) - KV_SERIALIZE(spent_key_images_list) - END_KV_SERIALIZE_MAP() - }; - typedef epee::misc_utils::struct_init response; - }; - struct COMMAND_RPC_DESCRIBE_TRANSFER { struct recipient