diff --git a/pkg/protocol/engine/consensus/slotgadget/totalweightslotgadget/gadget.go b/pkg/protocol/engine/consensus/slotgadget/totalweightslotgadget/gadget.go index 63df6ec56..84dd24ec8 100644 --- a/pkg/protocol/engine/consensus/slotgadget/totalweightslotgadget/gadget.go +++ b/pkg/protocol/engine/consensus/slotgadget/totalweightslotgadget/gadget.go @@ -42,14 +42,16 @@ func NewProvider(opts ...options.Option[Gadget]) module.Provider[*engine.Engine, e.ConstructedEvent().OnTrigger(func() { g.seatManager = e.SybilProtection.SeatManager() - e.Events.BlockGadget.BlockConfirmed.Hook(g.trackVotes) - g.storeLastFinalizedSlotFunc = func(slot iotago.SlotIndex) { if err := e.Storage.Settings().SetLatestFinalizedSlot(slot); err != nil { g.errorHandler(ierrors.Wrap(err, "failed to set latest finalized slot")) } } + g.ConstructedEvent().Trigger() + + e.Events.BlockGadget.BlockConfirmed.Hook(g.trackVotes) + e.InitializedEvent().OnTrigger(func() { // Can't use setter here as it has a side effect. g.mutex.Lock() @@ -79,8 +81,6 @@ func New(subModule module.Module, engine *engine.Engine, opts ...options.Option[ g.ShutdownEvent().OnTrigger(func() { g.StoppedEvent().Trigger() }) - - g.ConstructedEvent().Trigger() }) } diff --git a/pkg/protocol/sybilprotection/sybilprotectionv1/sybilprotection.go b/pkg/protocol/sybilprotection/sybilprotectionv1/sybilprotection.go index f9e1111d8..00acef023 100644 --- a/pkg/protocol/sybilprotection/sybilprotectionv1/sybilprotection.go +++ b/pkg/protocol/sybilprotection/sybilprotectionv1/sybilprotection.go @@ -63,6 +63,8 @@ func NewProvider(opts ...options.Option[SybilProtection]) module.Provider[*engin } } + s.ConstructedEvent().Trigger() + // When the engine is triggered initialized, snapshot has been read or database has been initialized properly, // so the committee should be available in the performance manager. e.InitializedEvent().OnTrigger(func() { @@ -99,8 +101,6 @@ func New(subModule module.Module, engine *engine.Engine, opts ...options.Option[ s.ShutdownEvent().OnTrigger(func() { s.StoppedEvent().Trigger() }) - - s.ConstructedEvent().Trigger() }) }