Skip to content

Commit

Permalink
Fix clear database
Browse files Browse the repository at this point in the history
  • Loading branch information
andyoknen committed Sep 8, 2022
1 parent 1a03ee9 commit 6280c07
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/pocketdb/repositories/ChainRepository.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ namespace PocketDb

LogPrintf("Rollback to first block..\n");
RollbackHeight(0);
RollbackBlockingList(0);
ClearBlockingList();

m_database.CreateStructure();

Expand Down Expand Up @@ -711,5 +711,19 @@ namespace PocketDb
LogPrint(BCLog::BENCH, " - RollbackList (Insert blocking list): %.2fms\n", 0.001 * (nTime2 - nTime1));
}

void ChainRepository::ClearBlockingList()
{
int64_t nTime0 = GetTimeMicros();

auto stmt = SetupSqlStatement(R"sql(
delete from BlockingLists
)sql");
TryStepStatement(stmt);

int64_t nTime1 = GetTimeMicros();
LogPrint(BCLog::BENCH, " - ClearBlockingList (Delete blocking list): %.2fms\n", 0.001 * (nTime1 - nTime0));
}



} // namespace PocketDb
1 change: 1 addition & 0 deletions src/pocketdb/repositories/ChainRepository.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ namespace PocketDb
private:

void RollbackBlockingList(int height);
void ClearBlockingList();
void RollbackHeight(int height);
void RestoreOldLast(int height);

Expand Down

0 comments on commit 6280c07

Please sign in to comment.