From 74d745e0c13f2cf1751a9dc0e471b9d1c4d4a51f Mon Sep 17 00:00:00 2001 From: woodser Date: Mon, 24 Jun 2019 13:55:14 -0400 Subject: [PATCH] collect outputs and discard irrelevant data --- src/wallet/MoneroWallet.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/wallet/MoneroWallet.cpp b/src/wallet/MoneroWallet.cpp index 68c6857..dfab017 100644 --- a/src/wallet/MoneroWallet.cpp +++ b/src/wallet/MoneroWallet.cpp @@ -664,7 +664,7 @@ namespace monero { mergeTx(tx, txMap, blockMap, false); } - // collect outputs, erase if filtered + // collect requested outputs and discard irrelevant data vector> vouts; for (map>::const_iterator txIter = txMap.begin(); txIter != txMap.end(); txIter++) { shared_ptr tx = txIter->second; @@ -675,9 +675,12 @@ namespace monero { vouts.push_back(voutWallet); voutIter++; } else { - voutIter = tx->vouts.erase(voutIter); + voutIter = tx->vouts.erase(voutIter); // remove irrelevant vouts } } + + // remove irrelevant txs + if (tx->vouts.empty()) tx->block.get()->txs.erase(std::remove(tx->block.get()->txs.begin(), tx->block.get()->txs.end(), tx), tx->block.get()->txs.end()); // TODO, no way to use const_iterator? } return vouts; }