aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorstoffu <stoffu@protonmail.ch>2018-01-30 19:55:39 +0900
committerstoffu <stoffu@protonmail.ch>2018-01-31 17:53:02 +0900
commita99ef176952defea20f4c9456bc489f46c7ea830 (patch)
tree79f17b6a844c8ac2bce26fa4d32ae10ac7ec2b9a
parentwallet-rpc: rename *_INDEX_OUTOFBOUND into *_INDEX_OUT_OF_BOUNDS (diff)
downloadmonero-a99ef176952defea20f4c9456bc489f46c7ea830.tar.xz
wallet-rpc: take subaddress account as arg for get_transfer_by_txid
-rw-r--r--src/wallet/wallet_rpc_server.cpp15
-rw-r--r--src/wallet/wallet_rpc_server_commands_defs.h2
2 files changed, 13 insertions, 4 deletions
diff --git a/src/wallet/wallet_rpc_server.cpp b/src/wallet/wallet_rpc_server.cpp
index eb18d5091..6ec249fc4 100644
--- a/src/wallet/wallet_rpc_server.cpp
+++ b/src/wallet/wallet_rpc_server.cpp
@@ -1889,8 +1889,15 @@ namespace tools
return false;
}
+ if (req.account_index >= m_wallet->get_num_subaddress_accounts())
+ {
+ er.code = WALLET_RPC_ERROR_CODE_ACCOUNT_INDEX_OUT_OF_BOUNDS;
+ er.message = "Account index is out of bound";
+ return false;
+ }
+
std::list<std::pair<crypto::hash, tools::wallet2::payment_details>> payments;
- m_wallet->get_payments(payments, 0);
+ m_wallet->get_payments(payments, 0, (uint64_t)-1, req.account_index);
for (std::list<std::pair<crypto::hash, tools::wallet2::payment_details>>::const_iterator i = payments.begin(); i != payments.end(); ++i) {
if (i->second.m_tx_hash == txid)
{
@@ -1900,7 +1907,7 @@ namespace tools
}
std::list<std::pair<crypto::hash, tools::wallet2::confirmed_transfer_details>> payments_out;
- m_wallet->get_payments_out(payments_out, 0);
+ m_wallet->get_payments_out(payments_out, 0, (uint64_t)-1, req.account_index);
for (std::list<std::pair<crypto::hash, tools::wallet2::confirmed_transfer_details>>::const_iterator i = payments_out.begin(); i != payments_out.end(); ++i) {
if (i->first == txid)
{
@@ -1910,7 +1917,7 @@ namespace tools
}
std::list<std::pair<crypto::hash, tools::wallet2::unconfirmed_transfer_details>> upayments;
- m_wallet->get_unconfirmed_payments_out(upayments);
+ m_wallet->get_unconfirmed_payments_out(upayments, req.account_index);
for (std::list<std::pair<crypto::hash, tools::wallet2::unconfirmed_transfer_details>>::const_iterator i = upayments.begin(); i != upayments.end(); ++i) {
if (i->first == txid)
{
@@ -1922,7 +1929,7 @@ namespace tools
m_wallet->update_pool_state();
std::list<std::pair<crypto::hash, tools::wallet2::pool_payment_details>> pool_payments;
- m_wallet->get_unconfirmed_payments(pool_payments);
+ m_wallet->get_unconfirmed_payments(pool_payments, req.account_index);
for (std::list<std::pair<crypto::hash, tools::wallet2::pool_payment_details>>::const_iterator i = pool_payments.begin(); i != pool_payments.end(); ++i) {
if (i->second.m_pd.m_tx_hash == txid)
{
diff --git a/src/wallet/wallet_rpc_server_commands_defs.h b/src/wallet/wallet_rpc_server_commands_defs.h
index e9f112b63..82b6b78f9 100644
--- a/src/wallet/wallet_rpc_server_commands_defs.h
+++ b/src/wallet/wallet_rpc_server_commands_defs.h
@@ -1291,9 +1291,11 @@ namespace wallet_rpc
struct request
{
std::string txid;
+ uint32_t account_index;
BEGIN_KV_SERIALIZE_MAP()
KV_SERIALIZE(txid);
+ KV_SERIALIZE_OPT(account_index, (uint32_t)0)
END_KV_SERIALIZE_MAP()
};