Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fall back to the confirmed state if the agreed state is nil. #2854

Merged
merged 3 commits into from
Dec 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading