Skip to content

Commit

Permalink
few fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
sandipbhoir committed Sep 3, 2019
1 parent 2b93ee9 commit 535d10a
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 22 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ if(SJ_TEST_SJ_TXNBLKS_PROCESS_SLOW)
endif()

if(SJ_TEST_SJ_MISSING_MBTXNS)
message(STATUS "SJ 2test enabled")
message(STATUS "SJ 2 test enabled")
add_definitions(-DSJ_TEST_SJ_MISSING_MBTXNS)
endif()

Expand Down
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ do
echo "Build with SJ test - New Seed misses the mbtxns message from multiplier"
;;
*)
echo "Usage $0 [cuda|opencl] [tsan|asan] [style] [heartbeattest] [fallbacktest] [vc<1-8>] [dm<1-9>]"
echo "Usage $0 [cuda|opencl] [tsan|asan] [style] [heartbeattest] [fallbacktest] [vc<1-8>] [dm<1-9>] [sj<1-2>]"
exit 1
;;
esac
Expand Down
36 changes: 16 additions & 20 deletions src/libLookup/Lookup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4319,34 +4319,30 @@ void Lookup::CheckAndFetchUnavailableMBs() {
m_startedFetchMissingMBsThread = true;
auto& unavailableMBs = m_mediator.m_node->GetUnavailableMicroBlocks();
unsigned int count = 0;
for (const auto& it : unavailableMBs) {
for (auto& m : unavailableMBs) {
// skip mbs from latest final block
if (it.first == m_mediator.m_currentEpochNum - 1) {
if (m.first == m_mediator.m_currentEpochNum - 1) {
continue;
}
LOG_GENERAL(INFO, "Unavailable microblock bodies in finalblock "
<< it.first << ": " << it.second.size());

// Delete missing mbs from unavailable list which has no txns or which is
// available in storage
auto mbsIt = it.second;
mbsIt.erase(
std::remove_if(mbsIt.begin(), mbsIt.end(),
[](const std::pair<BlockHash, TxnHash> e) {
MicroBlockSharedPtr mbptr;
return e.second == TxnHash() ||
BlockStorage::GetBlockStorage().GetMicroBlock(
e.first, mbptr);
}),
mbsIt.end());
<< m.first << ": " << m.second.size());

// Delete missing mbs from unavailable list which has no txns
auto& mbs = m.second;
mbs.erase(std::remove_if(mbs.begin(), mbs.end(),
[](const std::pair<BlockHash, TxnHash> e) {
MicroBlockSharedPtr mbptr;
return e.second == TxnHash();
}),
mbs.end());

LOG_GENERAL(INFO,
"After deleting microblock bodies with no transactions, "
"Unavailable count = "
<< mbsIt.size());
<< mbs.size());

vector<BlockHash> mbHashes;
for (auto it2 : mbsIt) {
for (const auto& mb : mbs) {
count++;
if (count > maxMBSToBeFetched) {
LOG_GENERAL(INFO, "Max fetch missing mbs limit of "
Expand All @@ -4356,8 +4352,8 @@ void Lookup::CheckAndFetchUnavailableMBs() {
break;
}
LOG_EPOCH(INFO, m_mediator.m_currentEpochNum,
"BlockHash = " << it2.first << ", TxnHash = " << it2.second);
mbHashes.emplace_back(it2.first);
"BlockHash = " << mb.first << ", TxnHash = " << mb.second);
mbHashes.emplace_back(mb.first);
}
SendGetMicroBlockFromLookup(mbHashes);
}
Expand Down

0 comments on commit 535d10a

Please sign in to comment.