Skip to content

Commit

Permalink
Restart scilla process at vacuous epoch (#3758) (#3796)
Browse files Browse the repository at this point in the history
  • Loading branch information
chetan-zilliqa committed Oct 4, 2023
1 parent 5400dd1 commit 4f020f6
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/libDirectoryService/FinalBlockPostProcessing.cpp
Expand Up @@ -34,6 +34,7 @@
#include "libUtils/DataConversion.h"
#include "libUtils/DetachedFunction.h"
#include "libUtils/Logger.h"
#include "libScilla/ScillaClient.h"

using namespace std;
using namespace boost::multiprecision;
Expand Down Expand Up @@ -219,6 +220,9 @@ void DirectoryService::ProcessFinalBlockConsensusWhenDone() {
}

if (isVacuousEpoch) {
// Restart scilla client after every vacuous epoch
ScillaClient::GetInstance().RestartScillaClient();

auto writeStateToDisk = [this]() -> void {
if (!AccountStore::GetInstance().MoveUpdatesToDisk(
m_mediator.m_dsBlockChain.GetLastBlock()
Expand Down
11 changes: 11 additions & 0 deletions src/libScilla/ScillaClient.cpp
Expand Up @@ -148,6 +148,17 @@ bool ScillaClient::OpenServer(uint32_t version) {
return true;
}

void ScillaClient::RestartScillaClient() {
LOG_MARKER();
if (ENABLE_SCILLA_MULTI_VERSION == true) {
for (const auto& entry : m_clients) {
CheckClient(entry.first, true);
}
} else {
CheckClient(0, true);
}
}

bool ScillaClient::CheckClient(uint32_t version, bool enforce) {
std::lock_guard<std::mutex> g(m_mutexMain);

Expand Down
2 changes: 2 additions & 0 deletions src/libScilla/ScillaClient.h
Expand Up @@ -44,6 +44,8 @@ class ScillaClient {

bool CheckClient(uint32_t version, bool enforce = false);

void RestartScillaClient();

void Init();

bool isScillaRuning();
Expand Down

0 comments on commit 4f020f6

Please sign in to comment.