Skip to content

Commit e39e2b5

Browse files
committed
refactor: update estimated time to head calc
1 parent 4648634 commit e39e2b5

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

backend/pkg/blobindexer/blobindexer.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ func (bi *BlobIndexer) index() error {
126126
return err
127127
}
128128

129-
if err := bi.validateSpec(spec); err != nil {
129+
if err := validateSpec(spec); err != nil {
130130
return err
131131
}
132132

@@ -349,7 +349,7 @@ func (bi *BlobIndexer) fetchBlockHeader(blockID string, header *constypes.Standa
349349
return nil
350350
}
351351

352-
func (bi *BlobIndexer) validateSpec(spec *constypes.StandardSpecResponse) error {
352+
func validateSpec(spec *constypes.StandardSpecResponse) error {
353353
if spec.Data.DenebForkEpoch == nil {
354354
return fmt.Errorf("DENEB_FORK_EPOCH not set in spec")
355355
}
@@ -505,7 +505,7 @@ func calculateEstimatedTimeToHeadDuration(estimatedTimeToHead float64) time.Dura
505505
}
506506

507507
func calculateEstimatedTimeToHead(headHeader *constypes.StandardBeaconHeaderResponse, batchStart uint64, slotsPerSecond float64) float64 {
508-
estimatedTimeToHead := float64(headHeader.Data.Header.Message.Slot-batchStart) / slotsPerSecond
508+
estimatedTimeToHead := float64(headHeader.Data.Header.Message.Slot) - float64(batchStart)/slotsPerSecond
509509
return estimatedTimeToHead
510510
}
511511

0 commit comments

Comments
 (0)