@@ -3393,12 +3393,13 @@ mapSproutNoteData_t CWallet::FindMySproutNotes(const CTransaction &tx) const
3393
3393
* the result of FindMySaplingNotes (for the addresses available at the time) will
3394
3394
* already have been cached in CWalletTx.mapSaplingNoteData.
3395
3395
*/
3396
- static void DecryptSaplingNoteWorker (const CWallet *wallet, std::vector<const SaplingIncomingViewingKey*> vIvk, std::vector<const OutputDescription*> vOutput, std::vector<uint32_t > vPosition, const uint256 hash, const int &height, mapSaplingNoteData_t *noteData, SaplingIncomingViewingKeyMap *viewingKeysToAdd)
3396
+ static void DecryptSaplingNoteWorker (const CWallet *wallet, std::vector<const SaplingIncomingViewingKey*> vIvk, std::vector<const OutputDescription*> vOutput, std::vector<uint32_t > vPosition, const uint256 hash, const int &height, mapSaplingNoteData_t *noteData, SaplingIncomingViewingKeyMap *viewingKeysToAdd, int threadNumber )
3397
3397
{
3398
3398
for (int i = 0 ; i < vIvk.size (); i++) {
3399
3399
const SaplingIncomingViewingKey ivk = *vIvk[i];
3400
+ const OutputDescription output = *vOutput[i];
3400
3401
3401
- auto result = SaplingNotePlaintext::decrypt (Params ().GetConsensus (), height, vOutput[i]-> encCiphertext , ivk, vOutput[i]-> ephemeralKey , vOutput[i]-> cmu );
3402
+ auto result = SaplingNotePlaintext::decrypt (Params ().GetConsensus (), height, output. encCiphertext , ivk, output. ephemeralKey , output. cmu );
3402
3403
if (result) {
3403
3404
3404
3405
auto address = ivk.address (result.get ().d );
@@ -3457,14 +3458,9 @@ std::pair<mapSaplingNoteData_t, SaplingIncomingViewingKeyMap> CWallet::FindMySap
3457
3458
3458
3459
// Protocol Spec: 4.19 Block Chain Scanning (Sapling)
3459
3460
int t = 0 ;
3460
- for (uint32_t i = 0 ; i < tx.vShieldedOutput .size (); ++i) {
3461
- // const OutputDescription output = tx.vShieldedOutput[i];
3462
-
3463
-
3464
- for (auto it = setSaplingIncomingViewingKeys.begin (); it != setSaplingIncomingViewingKeys.end (); ++it) {
3465
- const SaplingIncomingViewingKey ivk = *it;
3466
-
3467
- vvIvk[t].emplace_back (&ivk);
3461
+ for (uint32_t i = 0 ; i < tx.vShieldedOutput .size (); i++) {
3462
+ for (auto it = setSaplingIncomingViewingKeys.begin (); it != setSaplingIncomingViewingKeys.end (); it++) {
3463
+ vvIvk[t].emplace_back (&(*it));
3468
3464
vvOutputDescrition[t].emplace_back (&tx.vShieldedOutput [i]);
3469
3465
vvPosition[t].emplace_back (i);
3470
3466
// Increment ivk vector
@@ -3473,13 +3469,14 @@ std::pair<mapSaplingNoteData_t, SaplingIncomingViewingKeyMap> CWallet::FindMySap
3473
3469
if (t >= vvIvk.size ()) {
3474
3470
t = 0 ;
3475
3471
}
3476
-
3477
3472
}
3478
3473
}
3479
3474
3480
3475
std::vector<boost::thread*> decryptionThreads;
3481
- for (int i = 0 ; i < vvIvk.size (); i++) {
3482
- decryptionThreads.emplace_back (new boost::thread (DecryptSaplingNoteWorker, this , vvIvk[i], vvOutputDescrition[i], vvPosition[i], hash, height, ¬eData, &viewingKeysToAdd));
3476
+ for (int i = 0 ; i < vvIvk.size (); ++i) {
3477
+ if (!vvIvk.empty ()) {
3478
+ decryptionThreads.emplace_back (new boost::thread (DecryptSaplingNoteWorker, this , vvIvk[i], vvOutputDescrition[i], vvPosition[i], hash, height, ¬eData, &viewingKeysToAdd, i));
3479
+ }
3483
3480
}
3484
3481
3485
3482
// Cleanup
0 commit comments