Skip to content

Commit cfa8c6d

Browse files
committed
Remove mShouldReportOnMain
1 parent 98aa6a4 commit cfa8c6d

File tree

2 files changed

+11
-15
lines changed

2 files changed

+11
-15
lines changed

src/ledger/LedgerManagerImpl.cpp

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,7 @@ LedgerManagerImpl::setState(State s)
367367
// like
368368
static std::set<std::pair<State, State>> valid{
369369
{LM_BOOTING_STATE, LM_BOOTED_STATE},
370+
{LM_BOOTED_STATE, LM_BOOTING_CATCHUP_STATE},
370371
{LM_BOOTING_STATE, LM_BOOTING_CATCHUP_STATE},
371372
{LM_BOOTING_CATCHUP_STATE, LM_CATCHING_UP_STATE},
372373
{LM_BOOTED_STATE, LM_SYNCED_STATE},
@@ -611,19 +612,16 @@ LedgerManagerImpl::loadLastKnownLedgerInternal(bool skipBuildingFullState)
611612
{
612613
mApplyState.compileAllContractsInLedger(
613614
snapshot, latestLedgerHeader.ledgerVersion);
614-
mShouldReportOnMain = true;
615615
mApp.postOnLedgerCloseThread(
616616
[this, snapshot, ledgerVersion{latestLedgerHeader.ledgerVersion}] {
617617
mApplyState.populateInMemorySorobanState(snapshot,
618618
ledgerVersion);
619619
mApp.postOnMainThread(
620620
[this] {
621-
if (mShouldReportOnMain)
621+
if (mState == LM_BOOTING_STATE)
622622
{
623623
mApplyState.markEndOfSetupPhase();
624-
setState(mState == LM_BOOTING_CATCHUP_STATE
625-
? LM_CATCHING_UP_STATE
626-
: LM_BOOTED_STATE);
624+
setState(LM_BOOTED_STATE);
627625
}
628626
},
629627
"Finish populating in-memory Soroban state");
@@ -633,8 +631,7 @@ LedgerManagerImpl::loadLastKnownLedgerInternal(bool skipBuildingFullState)
633631
else
634632
{
635633
mApplyState.markEndOfSetupPhase();
636-
setState(mState == LM_BOOTING_CATCHUP_STATE ? LM_CATCHING_UP_STATE
637-
: LM_BOOTED_STATE);
634+
setState(LM_BOOTED_STATE);
638635
}
639636
}
640637

@@ -1257,8 +1254,8 @@ LedgerManagerImpl::valueExternalized(LedgerCloseData const& ledgerData,
12571254
"Lost sync, local LCL is {}, network closed ledger {}",
12581255
getLastClosedLedgerHeader().header.ledgerSeq,
12591256
ledgerData.getLedgerSeq());
1260-
setState(mState == LM_BOOTING_STATE ? LM_BOOTING_CATCHUP_STATE
1261-
: LM_CATCHING_UP_STATE);
1257+
releaseAssert(mState != LM_BOOTING_STATE);
1258+
setState(LM_CATCHING_UP_STATE);
12621259
}
12631260
}
12641261
}
@@ -1268,9 +1265,10 @@ LedgerManagerImpl::startCatchup(CatchupConfiguration configuration,
12681265
std::shared_ptr<HistoryArchive> archive)
12691266
{
12701267
ZoneScoped;
1271-
releaseAssert(mState == LM_BOOTING_STATE || mState == LM_BOOTED_STATE);
1272-
setState(mState == LM_BOOTING_STATE ? LM_BOOTING_CATCHUP_STATE
1273-
: LM_CATCHING_UP_STATE);
1268+
if (mState == LM_BOOTED_STATE)
1269+
{
1270+
setState(LM_CATCHING_UP_STATE);
1271+
}
12741272
mApp.getLedgerApplyManager().startCatchup(configuration, archive);
12751273
}
12761274

@@ -1879,7 +1877,7 @@ LedgerManagerImpl::setLastClosedLedger(
18791877
releaseAssert(threadIsMain());
18801878
mApplyState.assertSetupPhase();
18811879
releaseAssert(mState == LM_CATCHING_UP_STATE ||
1882-
mState == LM_BOOTING_CATCHUP_STATE);
1880+
mState == LM_BOOTING_STATE || mState == LM_BOOTED_STATE);
18831881
setState(LM_BOOTING_CATCHUP_STATE);
18841882

18851883
LedgerTxn ltx(mApp.getLedgerTxnRoot());
@@ -1904,7 +1902,6 @@ LedgerManagerImpl::setLastClosedLedger(
19041902
// If we happen to still be doing the initial boot, we don't want to
19051903
// mark as ready to apply until we have finished the population from
19061904
// this method
1907-
mShouldReportOnMain = false;
19081905
// This should not be additionally conditionalized on lv >= anything,
19091906
// since we want to support SOROBAN_TEST_EXTRA_PROTOCOL > lv.
19101907
//

src/ledger/LedgerManagerImpl.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,6 @@ class LedgerManagerImpl : public LedgerManager
409409
Config const& config);
410410

411411
State mState;
412-
bool mShouldReportOnMain;
413412

414413
#ifdef BUILD_TESTS
415414
std::vector<TransactionMetaFrame> mLastLedgerTxMeta;

0 commit comments

Comments
 (0)