Skip to content

Commit

Permalink
Keep hold of lock
Browse files Browse the repository at this point in the history
  • Loading branch information
Jouzo committed Oct 29, 2024
1 parent 840664d commit 07552f7
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 07552f7

Please sign in to comment.