Allow get_bulk_payments to return all payments regardless of payment ID

by giving an empty list of payment IDs.
This commit is contained in:
moneromooo-monero 2015-01-10 19:32:08 +00:00
parent 24ddfa792e
commit 87839cd484
No known key found for this signature in database
GPG key ID: 686F07454D6CEFC3
3 changed files with 45 additions and 12 deletions

View file

@ -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;