Skip to content

Commit

Permalink
Revert "Revert "Keep hold of lock""
Browse files Browse the repository at this point in the history
This reverts commit 29a423c.
  • Loading branch information
Jouzo committed Oct 30, 2024
1 parent c199613 commit c804196
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/ocean.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,19 +71,20 @@ bool CatchupOceanIndexer() {
const auto startTime = std::chrono::steady_clock::now();

CBlockIndex *pindex = nullptr;
while (currentHeight < tipHeight) {

// Lock for the whole catchup duration
LOCK(cs_main);

while (currentHeight <= tipHeight) {
if (ShutdownRequested()) {
LogPrintf("Shutdown requested, exiting ocean catchup...\n");
return false;
}

{
LOCK(cs_main);
pindex = ::ChainActive()[currentHeight];
if (!pindex) {
LogPrintf("Error: Cannot find block at height %u\n", currentHeight);
return false;
}
pindex = ::ChainActive()[currentHeight];
if (!pindex) {
LogPrintf("Error: Cannot find block at height %u\n", currentHeight);
return false;
}

CBlock block;
Expand Down

0 comments on commit c804196

Please sign in to comment.