From d875a9ff905997062366162880ba46a359b1f7f9 Mon Sep 17 00:00:00 2001
From: moneromooo-monero <moneromooo-monero@users.noreply.github.com>
Date: Tue, 21 Nov 2017 19:27:33 +0000
Subject: [PATCH] wallet2: detect multiple outputs from a tx to different
 subaddresses

---
 src/wallet/wallet2.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp
index 00b096b88..5f6c1f20d 100644
--- a/src/wallet/wallet2.cpp
+++ b/src/wallet/wallet2.cpp
@@ -433,7 +433,7 @@ static void emplace_or_replace(std::unordered_multimap<crypto::hash, tools::wall
   auto range = container.equal_range(key);
   for (auto i = range.first; i != range.second; ++i)
   {
-    if (i->second.m_pd.m_tx_hash == pd.m_pd.m_tx_hash)
+    if (i->second.m_pd.m_tx_hash == pd.m_pd.m_tx_hash && i->second.m_pd.m_subaddr_index == pd.m_pd.m_subaddr_index)
     {
       i->second = pd;
       return;