aboutsummaryrefslogtreecommitdiff
path: root/src/wallet
diff options
context:
space:
mode:
authorstoffu <stoffu@protonmail.ch>2019-12-16 13:12:31 +0900
committerstoffu <stoffu@protonmail.ch>2019-12-16 21:10:11 +0900
commitae84ec90c8756ceaa2f05c00ad9dc943ac35b46f (patch)
treecab1e0eeb32ce8be506e48b7f0b8f27a50538466 /src/wallet
parentMerge pull request #6057 (diff)
downloadmonero-ae84ec90c8756ceaa2f05c00ad9dc943ac35b46f.tar.xz
wallet-cli/rpc: allow sweep_all to use outputs in all subaddresses within an account
Diffstat (limited to 'src/wallet')
-rw-r--r--src/wallet/wallet_rpc_server.cpp13
-rw-r--r--src/wallet/wallet_rpc_server_commands_defs.h4
2 files changed, 15 insertions, 2 deletions
diff --git a/src/wallet/wallet_rpc_server.cpp b/src/wallet/wallet_rpc_server.cpp
index de501f056..2a5cd1772 100644
--- a/src/wallet/wallet_rpc_server.cpp
+++ b/src/wallet/wallet_rpc_server.cpp
@@ -1394,11 +1394,22 @@ namespace tools
return false;
}
+ std::set<uint32_t> subaddr_indices;
+ if (req.subaddr_indices_all)
+ {
+ for (uint32_t i = 0; i < m_wallet->get_num_subaddresses(req.account_index); ++i)
+ subaddr_indices.insert(i);
+ }
+ else
+ {
+ subaddr_indices= req.subaddr_indices;
+ }
+
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);
- 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);
+ 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, 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);
diff --git a/src/wallet/wallet_rpc_server_commands_defs.h b/src/wallet/wallet_rpc_server_commands_defs.h
index 0c86f404d..f833eaaff 100644
--- a/src/wallet/wallet_rpc_server_commands_defs.h
+++ b/src/wallet/wallet_rpc_server_commands_defs.h
@@ -47,7 +47,7 @@
// advance which version they will stop working with
// Don't go over 32767 for any of these
#define WALLET_RPC_VERSION_MAJOR 1
-#define WALLET_RPC_VERSION_MINOR 16
+#define WALLET_RPC_VERSION_MINOR 17
#define MAKE_WALLET_RPC_VERSION(major,minor) (((major)<<16)|(minor))
#define WALLET_RPC_VERSION MAKE_WALLET_RPC_VERSION(WALLET_RPC_VERSION_MAJOR, WALLET_RPC_VERSION_MINOR)
namespace tools
@@ -749,6 +749,7 @@ namespace wallet_rpc
std::string address;
uint32_t account_index;
std::set<uint32_t> subaddr_indices;
+ bool subaddr_indices_all;
uint32_t priority;
uint64_t ring_size;
uint64_t outputs;
@@ -764,6 +765,7 @@ namespace wallet_rpc
KV_SERIALIZE(address)
KV_SERIALIZE(account_index)
KV_SERIALIZE(subaddr_indices)
+ KV_SERIALIZE_OPT(subaddr_indices_all, false)
KV_SERIALIZE(priority)
KV_SERIALIZE_OPT(ring_size, (uint64_t)0)
KV_SERIALIZE_OPT(outputs, (uint64_t)1)