Skip to content

Commit

Permalink
Merge pull request #2478 from sisuresh/catchupLogBug
Browse files Browse the repository at this point in the history
Fix catchup log message when catching up to current

Reviewed-by: MonsieurNicolas
  • Loading branch information
latobarita authored Mar 31, 2020
2 parents 22fc91c + 9706415 commit f25cabe
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions src/catchup/CatchupWork.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,25 @@ CatchupWork::~CatchupWork()
std::string
CatchupWork::getStatus() const
{
return fmt::format(
"Catching up to ledger {}: {}", mCatchupConfiguration.toLedger(),
mCurrentWork ? mCurrentWork->getStatus() : Work::getStatus());
std::string toLedger;
if (mCatchupConfiguration.toLedger() == CatchupConfiguration::CURRENT)
{
toLedger = mGetHistoryArchiveStateWork &&
mGetHistoryArchiveStateWork->getState() ==
State::WORK_SUCCESS
? std::to_string(mGetHistoryArchiveStateWork
->getHistoryArchiveState()
.currentLedger)
: "CURRENT";
}
else
{
toLedger = std::to_string(mCatchupConfiguration.toLedger());
}

return fmt::format("Catching up to ledger {}: {}", toLedger,
mCurrentWork ? mCurrentWork->getStatus()
: Work::getStatus());
}

void
Expand Down

0 comments on commit f25cabe

Please sign in to comment.