aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/wallet_rpc_server.cpp
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2018-09-21 20:46:22 +0200
committerRiccardo Spagni <ric@spagni.net>2018-09-21 20:46:22 +0200
commit85110b42ab5941ab8e71592dfa432d4b0cc99055 (patch)
tree5f6e7b074557cc97d87dcc5999e7dd463d65b06e /src/wallet/wallet_rpc_server.cpp
parentMerge pull request #4399 (diff)
parentREADME: harmonize command formatting inside README.md (diff)
downloadmonero-85110b42ab5941ab8e71592dfa432d4b0cc99055.tar.xz
Merge pull request #4401
66901901 README: harmonize command formatting inside README.md (Andrea) 8cd98408 disable AES on s390x architecture (Tuan M. Hoang) 4ed30bab wallet: implement coin splitting for sweep_* 'outputs' option (whythat) 24f52396 wallet: add 'outputs' option for sweep_* commands (whythat) 52e19d69 README: Compile boost with cxxflags=-fPIC cflags=-fPIC (Italocoin Project) 0c77523d README: fill in libsodium package name for Arch (phloatingman)
Diffstat (limited to 'src/wallet/wallet_rpc_server.cpp')
-rw-r--r--src/wallet/wallet_rpc_server.cpp18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/wallet/wallet_rpc_server.cpp b/src/wallet/wallet_rpc_server.cpp
index 86b46b173..6361a6cfa 100644
--- a/src/wallet/wallet_rpc_server.cpp
+++ b/src/wallet/wallet_rpc_server.cpp
@@ -1102,6 +1102,13 @@ namespace tools
return false;
}
+ if (req.outputs < 1)
+ {
+ er.code = WALLET_RPC_ERROR_CODE_TX_NOT_POSSIBLE;
+ er.message = "Amount of outputs should be greater than 0.";
+ return false;
+ }
+
try
{
uint64_t mixin;
@@ -1114,7 +1121,7 @@ namespace tools
mixin = m_wallet->adjust_mixin(req.mixin);
}
uint32_t priority = m_wallet->adjust_priority(req.priority);
- std::vector<wallet2::pending_tx> ptx_vector = m_wallet->create_transactions_all(req.below_amount, dsts[0].addr, dsts[0].is_subaddress, mixin, req.unlock_time, priority, extra, req.account_index, req.subaddr_indices);
+ std::vector<wallet2::pending_tx> ptx_vector = m_wallet->create_transactions_all(req.below_amount, dsts[0].addr, dsts[0].is_subaddress, req.outputs, mixin, req.unlock_time, priority, extra, req.account_index, req.subaddr_indices);
return fill_response(ptx_vector, req.get_tx_keys, res.tx_key_list, res.amount_list, res.fee_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, er);
@@ -1140,6 +1147,13 @@ namespace tools
return false;
}
+ if (req.outputs < 1)
+ {
+ er.code = WALLET_RPC_ERROR_CODE_TX_NOT_POSSIBLE;
+ er.message = "Amount of outputs should be greater than 0.";
+ return false;
+ }
+
// validate the transfer requested and populate dsts & extra
std::list<wallet_rpc::transfer_destination> destination;
destination.push_back(wallet_rpc::transfer_destination());
@@ -1170,7 +1184,7 @@ namespace tools
mixin = m_wallet->adjust_mixin(req.mixin);
}
uint32_t priority = m_wallet->adjust_priority(req.priority);
- std::vector<wallet2::pending_tx> ptx_vector = m_wallet->create_transactions_single(ki, dsts[0].addr, dsts[0].is_subaddress, mixin, req.unlock_time, priority, extra);
+ std::vector<wallet2::pending_tx> ptx_vector = m_wallet->create_transactions_single(ki, dsts[0].addr, dsts[0].is_subaddress, req.outputs, mixin, req.unlock_time, priority, extra);
if (ptx_vector.empty())
{