From f2c1e3784d8b29e38abcc579aeb2d05382b5dd9d Mon Sep 17 00:00:00 2001 From: goatpig Date: Thu, 13 Dec 2018 21:13:08 +0100 Subject: [PATCH] fix zc ledger overwriting --- cppForSwig/BlockDataViewer.cpp | 11 +++++++---- cppForSwig/BtcWallet.cpp | 5 +++-- cppForSwig/ScrAddrObj.h | 2 +- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/cppForSwig/BlockDataViewer.cpp b/cppForSwig/BlockDataViewer.cpp index 8d22031ad..7e71f5c12 100644 --- a/cppForSwig/BlockDataViewer.cpp +++ b/cppForSwig/BlockDataViewer.cpp @@ -188,13 +188,16 @@ void BlockDataViewer::scanWallets(shared_ptr action) scanData.startBlock_ = *sbIter; group.scanWallets(scanData, updateID_); - if (leVecPtr != nullptr) + sbIter++; + } + + if (leVecPtr != nullptr) + { + for (auto& walletLedgerMap : scanData.saStruct_.zcLedgers_) { - for (auto& lePair : scanData.saStruct_.zcLedgers_) + for(auto& lePair : walletLedgerMap.second) leVecPtr->push_back(lePair.second); } - - sbIter++; } lastScanned_ = endBlock; diff --git a/cppForSwig/BtcWallet.cpp b/cppForSwig/BtcWallet.cpp index 4eaf6b866..c00520be0 100644 --- a/cppForSwig/BtcWallet.cpp +++ b/cppForSwig/BtcWallet.cpp @@ -501,8 +501,9 @@ bool BtcWallet::scanWallet(ScanWalletStruct& scanInfo, int32_t updateID) if (iter == ledgerMap.end()) continue; - scanInfo.saStruct_.zcLedgers_.insert( - make_pair(iter->first, iter->second)); + auto& walletZcLedgers = + scanInfo.saStruct_.zcLedgers_[walletID()]; + walletZcLedgers.insert(*iter); } } diff --git a/cppForSwig/ScrAddrObj.h b/cppForSwig/ScrAddrObj.h index 77a2023dd..3354e2f03 100644 --- a/cppForSwig/ScrAddrObj.h +++ b/cppForSwig/ScrAddrObj.h @@ -46,7 +46,7 @@ struct ScanAddressStruct std::shared_ptr< ZeroConfSharedStateSnapshot> zcState_; std::map>>> zcMap_; - std::map zcLedgers_; + std::map> zcLedgers_; std::shared_ptr>>> newKeysAndScrAddr_; };