Merge pull request #4484

2c74b1a1 wallet_rpc_server: include all transfer records for a txid (moneromooo-monero)
This commit is contained in:
Riccardo Spagni 2018-10-02 22:40:51 +02:00
parent e0fa7fa384
commit 9570081ae5
No known key found for this signature in database
GPG Key ID: 55432DF31CCD4FCD
2 changed files with 17 additions and 9 deletions

View File

@ -2173,8 +2173,8 @@ namespace tools
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)
{
fill_transfer_entry(res.transfer, i->second.m_tx_hash, i->first, i->second);
return true;
res.transfers.resize(res.transfers.size() + 1);
fill_transfer_entry(res.transfers.back(), i->second.m_tx_hash, i->first, i->second);
}
}
@ -2183,8 +2183,8 @@ namespace tools
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)
{
fill_transfer_entry(res.transfer, i->first, i->second);
return true;
res.transfers.resize(res.transfers.size() + 1);
fill_transfer_entry(res.transfers.back(), i->first, i->second);
}
}
@ -2193,8 +2193,8 @@ namespace tools
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)
{
fill_transfer_entry(res.transfer, i->first, i->second);
return true;
res.transfers.resize(res.transfers.size() + 1);
fill_transfer_entry(res.transfers.back(), i->first, i->second);
}
}
@ -2205,11 +2205,17 @@ namespace tools
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)
{
fill_transfer_entry(res.transfer, i->first, i->second);
return true;
res.transfers.resize(res.transfers.size() + 1);
fill_transfer_entry(res.transfers.back(), i->first, i->second);
}
}
if (!res.transfers.empty())
{
res.transfer = res.transfers.front(); // backward compat
return true;
}
er.code = WALLET_RPC_ERROR_CODE_WRONG_TXID;
er.message = "Transaction not found.";
return false;

View File

@ -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 3
#define WALLET_RPC_VERSION_MINOR 4
#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
@ -1399,9 +1399,11 @@ namespace wallet_rpc
struct response
{
transfer_entry transfer;
std::list<transfer_entry> transfers;
BEGIN_KV_SERIALIZE_MAP()
KV_SERIALIZE(transfer);
KV_SERIALIZE(transfers);
END_KV_SERIALIZE_MAP()
};
};