wallet_rpc_server: include all transfer records for a txid
Since subaddresses were added, a tx can now create more than one payment
This commit is contained in:
parent
bbf58ddc85
commit
00bf0b5ef0
|
@ -1938,8 +1938,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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1948,8 +1948,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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1958,8 +1958,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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1970,11 +1970,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;
|
||||
|
|
|
@ -39,6 +39,17 @@
|
|||
#undef MONERO_DEFAULT_LOG_CATEGORY
|
||||
#define MONERO_DEFAULT_LOG_CATEGORY "wallet.rpc"
|
||||
|
||||
// When making *any* change here, bump minor
|
||||
// If the change is incompatible, then bump major and set minor to 0
|
||||
// This ensures WALLET_RPC_VERSION always increases, that every change
|
||||
// has its own version, and that clients can just test major to see
|
||||
// whether they can talk to a given wallet without having to know in
|
||||
// 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 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
|
||||
{
|
||||
namespace wallet_rpc
|
||||
|
@ -1311,9 +1322,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()
|
||||
};
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue