From ec064abbdf0ad3837bf321268051ec305e3196fa Mon Sep 17 00:00:00 2001 From: Simon Date: Thu, 2 Aug 2018 22:30:30 -0700 Subject: [PATCH] Iterate over mapSaplingFullViewingKeys with ivk->fvk mapping (1:1). When diversified addresses are supported, iterating over mapSaplingIncomingViewingKeys will be inefficient as the mapping will be addresses->ivk (n:1). --- src/wallet/wallet.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index aeeda4d6b..6f682cc05 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1617,8 +1617,8 @@ mapSaplingNoteData_t CWallet::FindMySaplingNotes(const CTransaction &tx) const // Protocol Spec: 4.19 Block Chain Scanning (Sapling) for (uint32_t i = 0; i < tx.vShieldedOutput.size(); ++i) { const OutputDescription output = tx.vShieldedOutput[i]; - for (auto it = mapSaplingIncomingViewingKeys.begin(); it != mapSaplingIncomingViewingKeys.end(); ++it) { - SaplingIncomingViewingKey ivk = it->second; + for (auto it = mapSaplingFullViewingKeys.begin(); it != mapSaplingFullViewingKeys.end(); ++it) { + SaplingIncomingViewingKey ivk = it->first; auto result = SaplingNotePlaintext::decrypt(output.encCiphertext, ivk, output.ephemeralKey, output.cm); if (!result) { continue;