diff options
author | Riccardo Spagni <ric@spagni.net> | 2015-01-15 13:59:37 +0200 |
---|---|---|
committer | Riccardo Spagni <ric@spagni.net> | 2015-01-15 13:59:48 +0200 |
commit | 580e0033579269ff54f3d6afe8871f2c6ed990b9 (patch) | |
tree | ce07001ddecd96c664469ba551bc99dfbc69e4b4 /src/wallet/wallet_rpc_server.cpp | |
parent | Merge #216 (diff) | |
parent | Allow get_bulk_payments to return all payments regardless of payment ID (diff) | |
download | monero-580e0033579269ff54f3d6afe8871f2c6ed990b9.tar.xz |
Merge pull request #214
87839cd Allow get_bulk_payments to return all payments regardless of payment ID (moneromooo-monero)
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; |