diff --git a/collector/collector.go b/collector/collector.go index 2c07a8f..cb6f1e1 100644 --- a/collector/collector.go +++ b/collector/collector.go @@ -142,6 +142,11 @@ func (c *Collector) Run() error { c.listener.RecalculateEpochStats() } + err = c.syncActivations() + if err != nil { + return errors.Join(errors.New("cannot sync activations"), err) + } + g := new(errgroup.Group) g.Go(func() error { err := c.syncStatusPump() diff --git a/collector/mesh.go b/collector/mesh.go index 29d82ab..6ce5ff7 100644 --- a/collector/mesh.go +++ b/collector/mesh.go @@ -236,6 +236,7 @@ func (c *Collector) syncAllRewards() error { func (c *Collector) syncActivations() error { received := c.listener.GetLastActivationReceived() + log.Info("Syncing activations from %d", received) err := c.dbClient.GetAtxsReceivedAfter(c.db, received, func(atx *types.VerifiedActivationTx) bool { c.listener.OnActivation(atx) diff --git a/collector/txs.go b/collector/txs.go index 2300e45..5f4e6ed 100644 --- a/collector/txs.go +++ b/collector/txs.go @@ -9,8 +9,12 @@ import ( ) func (c *Collector) transactionsPump() error { + epochNumLayers := c.listener.GetEpochNumLayers() + lastLayer := c.listener.GetLastLayer(context.Background()) + currentEpoch := lastLayer / epochNumLayers + req := pb.TransactionResultsRequest{ - Start: 1, + Start: (currentEpoch - 2) * epochNumLayers, Watch: true, }