diff --git a/src/pocketdb/repositories/ChainRepository.cpp b/src/pocketdb/repositories/ChainRepository.cpp index 6c0f476c1..80781e453 100644 --- a/src/pocketdb/repositories/ChainRepository.cpp +++ b/src/pocketdb/repositories/ChainRepository.cpp @@ -68,7 +68,7 @@ namespace PocketDb LogPrintf("Rollback to first block..\n"); RollbackHeight(0); - RollbackBlockingList(0); + ClearBlockingList(); m_database.CreateStructure(); @@ -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 diff --git a/src/pocketdb/repositories/ChainRepository.h b/src/pocketdb/repositories/ChainRepository.h index c1dde9623..236aed093 100644 --- a/src/pocketdb/repositories/ChainRepository.h +++ b/src/pocketdb/repositories/ChainRepository.h @@ -51,6 +51,7 @@ namespace PocketDb private: void RollbackBlockingList(int height); + void ClearBlockingList(); void RollbackHeight(int height); void RestoreOldLast(int height);