Skip to content

Commit e421729

Browse files
Merge pull request #3641 from OffchainLabs/retry_fast_confirm_backport
Make sure to retry fast confirmation on failure
2 parents 42be4fe + ecb79c9 commit e421729

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

bold/assertions/confirmation.go

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,11 @@ func (m *Manager) keepTryingAssertionConfirmation(ctx context.Context, assertion
5151
confirmed, err = m.chain.FastConfirmAssertion(ctx, creationInfo)
5252
if err != nil {
5353
log.Error("Could not fast confirm latest assertion", "err", err)
54-
return
55-
}
56-
if confirmed {
54+
} else if confirmed {
5755
assertionConfirmedCounter.Inc(1)
5856
log.Info("Fast Confirmed assertion", "assertionHash", creationInfo.AssertionHash)
57+
return
5958
}
60-
return
6159
}
6260
prevCreationInfo, err := retry.UntilSucceeds(ctx, func() (*protocol.AssertionCreatedInfo, error) {
6361
return m.chain.ReadAssertionCreationInfo(ctx, creationInfo.ParentAssertionHash)
@@ -75,6 +73,17 @@ func (m *Manager) keepTryingAssertionConfirmation(ctx context.Context, assertion
7573
case <-ctx.Done():
7674
return
7775
case <-ticker.C:
76+
if m.enableFastConfirmation {
77+
var confirmed bool
78+
confirmed, err = m.chain.FastConfirmAssertion(ctx, creationInfo)
79+
if err != nil {
80+
log.Error("Could not fast confirm latest assertion", "err", err)
81+
} else if confirmed {
82+
assertionConfirmedCounter.Inc(1)
83+
log.Info("Fast Confirmed assertion", "assertionHash", creationInfo.AssertionHash)
84+
return
85+
}
86+
}
7887
opts := m.chain.GetCallOptsWithDesiredRpcHeadBlockNumber(&bind.CallOpts{Context: ctx})
7988
parentAssertion, err := m.chain.GetAssertion(
8089
ctx,

0 commit comments

Comments
 (0)