@@ -15,10 +15,9 @@ import (
15
15
"github.com/filecoin-project/go-f3/internal/clock"
16
16
"github.com/filecoin-project/go-f3/internal/psutil"
17
17
"github.com/filecoin-project/go-f3/manifest"
18
- "go.opentelemetry.io/otel/metric"
19
-
20
18
pubsub "github.com/libp2p/go-libp2p-pubsub"
21
19
peer "github.com/libp2p/go-libp2p/core/peer"
20
+ "go.opentelemetry.io/otel/metric"
22
21
"go.uber.org/multierr"
23
22
"golang.org/x/sync/errgroup"
24
23
)
@@ -188,6 +187,18 @@ func (h *gpbftRunner) Start(ctx context.Context) (_err error) {
188
187
}
189
188
190
189
func (h * gpbftRunner ) receiveCertificate (c * certs.FinalityCertificate ) error {
190
+ // Call to Finalize checkpoints the tipset in Lotus chain store. This may cause a
191
+ // sync in a case where the target tipset is not already stored by the chain
192
+ // store, which is a blocking operation.
193
+ //
194
+ // Triggering the checkpointing here means that certstore remains the sole source
195
+ // of truth in terms of tipset has been finalised.
196
+ if err := h .ec .Finalize (h .runningCtx , c .ECChain .Head ().Key ); err != nil {
197
+ err := fmt .Errorf ("error while finalizing decision at EC: %w" , err )
198
+ log .Error (err )
199
+ return err
200
+ }
201
+
191
202
nextInstance := c .GPBFTInstance + 1
192
203
currentInstance := h .participant .CurrentInstance ()
193
204
if h .participant .CurrentInstance () >= nextInstance {
@@ -428,7 +439,7 @@ func (h *gpbftHost) collectChain(base ec.TipSet, head ec.TipSet) ([]ec.TipSet, e
428
439
return res [1 :], nil
429
440
}
430
441
431
- func (h * gpbftRunner ) Stop (_ctx context.Context ) error {
442
+ func (h * gpbftRunner ) Stop (context.Context ) error {
432
443
h .ctxCancel ()
433
444
return multierr .Combine (
434
445
h .errgrp .Wait (),
@@ -624,7 +635,7 @@ func (h *gpbftHost) SetAlarm(at time.Time) {
624
635
// we cannot reuse the timer because we don't know if it was read or not
625
636
h .alertTimer .Stop ()
626
637
if at .IsZero () {
627
- // It "at" is zero, we cancel the timer entirely. Unfortunately, we still have to
638
+ // If "at" is zero, we cancel the timer entirely. Unfortunately, we still have to
628
639
// replace it for the reason stated above.
629
640
h .alertTimer = h .clock .Timer (0 )
630
641
if ! h .alertTimer .Stop () {
0 commit comments