From 01c6ec0d82db65875c177816c703b93ef2db2e7c Mon Sep 17 00:00:00 2001 From: Chris Hager Date: Sun, 2 Jun 2024 15:52:04 +0200 Subject: [PATCH] cleanup --- services/bidcollect/data-api-poller.go | 4 ++-- services/bidcollect/getheader-poller.go | 1 - services/bidcollect/types.go | 7 ++----- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/services/bidcollect/data-api-poller.go b/services/bidcollect/data-api-poller.go index e07f0e1..fea2aa1 100644 --- a/services/bidcollect/data-api-poller.go +++ b/services/bidcollect/data-api-poller.go @@ -47,7 +47,7 @@ func (poller *DataAPIPoller) Start() { tNextSlot := common.SlotToTime(nextSlot) untilNextSlot := tNextSlot.Sub(t) - poller.Log.Infof("[data-api poller] waiting until start of next slot (%d, %s from now)", nextSlot, untilNextSlot.String()) + poller.Log.Infof("[data-api poller] waiting until start of next slot (%d - %s from now)", nextSlot, untilNextSlot.String()) time.Sleep(untilNextSlot) // then run polling loop @@ -59,7 +59,7 @@ func (poller *DataAPIPoller) Start() { tNextSlot := common.SlotToTime(nextSlot) untilNextSlot := tNextSlot.Sub(t) - poller.Log.Infof("[data-api poller] current slot: %d / next slot: %d (%s), waitTime: %s", slot, nextSlot, tNextSlot.String(), untilNextSlot.String()) + poller.Log.Infof("[data-api poller] scheduling polling for upcoming slot: %d (%s - in %s)", nextSlot, tNextSlot.String(), untilNextSlot.String()) // Schedule polling at t-4, t-2, t=0, t=2 go poller.pollRelaysForBids(nextSlot, -4*time.Second) diff --git a/services/bidcollect/getheader-poller.go b/services/bidcollect/getheader-poller.go index c9da027..07b90bb 100644 --- a/services/bidcollect/getheader-poller.go +++ b/services/bidcollect/getheader-poller.go @@ -121,7 +121,6 @@ func (poller *GetHeaderPoller) Start() { if nextProposerPubkey == "" { poller.log.WithField("duties", duties).Error("no proposerPubkey for next slot") } else { - go poller.pollRelaysForBids(-2*time.Second, nextSlot, block.Data.Message.Body.ExecutionPayload.BlockHash.String(), duties[nextSlot]) go poller.pollRelaysForBids(0*time.Second, nextSlot, block.Data.Message.Body.ExecutionPayload.BlockHash.String(), duties[nextSlot]) go poller.pollRelaysForBids(1500*time.Millisecond, nextSlot, block.Data.Message.Body.ExecutionPayload.BlockHash.String(), duties[nextSlot]) } diff --git a/services/bidcollect/types.go b/services/bidcollect/types.go index 8ca8d03..678a074 100644 --- a/services/bidcollect/types.go +++ b/services/bidcollect/types.go @@ -58,11 +58,6 @@ func (bid *CommonBid) ValueAsBigInt() *big.Int { } func (bid *CommonBid) ToCSVFields() []string { - slotTms := bid.TimestampMs - common.SlotToTime(bid.Slot).UnixMilli() - if bid.TimestampMs == 0 { - slotTms = bid.ReceivedAtMs - common.SlotToTime(bid.Slot).UnixMilli() - } - tsMs := bid.TimestampMs if tsMs == 0 { if bid.Timestamp > 0 { @@ -72,6 +67,8 @@ func (bid *CommonBid) ToCSVFields() []string { } } + slotTms := tsMs - common.SlotToTime(bid.Slot).UnixMilli() + return []string{ // Collector-internal fields fmt.Sprint(bid.SourceType), fmt.Sprint(bid.ReceivedAtMs),