diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2015-01-10 19:32:08 +0000 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2015-01-11 12:04:05 +0000 |
commit | 87839cd4843efb231f0406881437d724dbf0161c (patch) | |
tree | 1e9cc35a0c81dadf4f0ff3bf0ee0f07d2b2d4a1d /src/wallet/wallet_rpc_server.cpp | |
parent | Merge pull request #206 (diff) | |
download | monero-87839cd4843efb231f0406881437d724dbf0161c.tar.xz |
Allow get_bulk_payments to return all payments regardless of payment ID
by giving an empty list of payment IDs.
Diffstat (limited to 'src/wallet/wallet_rpc_server.cpp')
-rw-r--r-- | src/wallet/wallet_rpc_server.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/wallet/wallet_rpc_server.cpp b/src/wallet/wallet_rpc_server.cpp index d7b3f8434..6b6bb4fe2 100644 --- a/src/wallet/wallet_rpc_server.cpp +++ b/src/wallet/wallet_rpc_server.cpp @@ -315,6 +315,26 @@ namespace tools { res.payments.clear(); + /* If the payment ID list is empty, we get payments to any payment ID (or lack thereof) */ + if (req.payment_ids.empty()) + { + std::list<std::pair<crypto::hash,wallet2::payment_details>> payment_list; + m_wallet.get_payments(payment_list, req.min_block_height); + + for (auto & payment : payment_list) + { + wallet_rpc::payment_details rpc_payment; + rpc_payment.payment_id = epee::string_tools::pod_to_hex(payment.first); + rpc_payment.tx_hash = epee::string_tools::pod_to_hex(payment.second.m_tx_hash); + rpc_payment.amount = payment.second.m_amount; + rpc_payment.block_height = payment.second.m_block_height; + rpc_payment.unlock_time = payment.second.m_unlock_time; + res.payments.push_back(std::move(rpc_payment)); + } + + return true; + } + for (auto & payment_id_str : req.payment_ids) { crypto::hash payment_id; |