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