Skip to content

Commit

Permalink
Merge pull request #2854 from OffchainLabs/fall-back-confirmed
Browse files Browse the repository at this point in the history
Fall back to the confirmed state if the agreed state is nil.
  • Loading branch information
eljobe authored Dec 30, 2024
2 parents 70dcc3d + 2fe54e7 commit c767dfe
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions staker/bold/bold_staker.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,20 +244,27 @@ func (b *BOLDStaker) Start(ctxIn context.Context) {
if err != nil {
log.Warn("error updating latest wasm module root", "err", err)
}
confirmedMsgCount, confirmedGlobalState, err := b.getLatestState(ctx, true)
if err != nil {
log.Error("staker: error checking latest confirmed", "err", err)
}

agreedMsgCount, agreedGlobalState, err := b.getLatestState(ctx, false)
if err != nil {
log.Error("staker: error checking latest agreed", "err", err)
}

if agreedGlobalState == nil {
// If we don't have a latest agreed global state, we should fall back to
// using the latest confirmed global state.
agreedGlobalState = confirmedGlobalState
agreedMsgCount = confirmedMsgCount
}
if agreedGlobalState != nil {
for _, notifier := range b.stakedNotifiers {
notifier.UpdateLatestStaked(agreedMsgCount, *agreedGlobalState)
}
}
confirmedMsgCount, confirmedGlobalState, err := b.getLatestState(ctx, true)
if err != nil {
log.Error("staker: error checking latest confirmed", "err", err)
}

if confirmedGlobalState != nil {
for _, notifier := range b.confirmedNotifiers {
Expand Down

0 comments on commit c767dfe

Please sign in to comment.