From 6fe07a5da0385fa408b35d3af0fc2cd5e91f0c02 Mon Sep 17 00:00:00 2001 From: ze97286 Date: Wed, 2 Oct 2024 12:47:06 +0100 Subject: [PATCH] fix: handle pap expiry correctly --- core/execution/spot/protocol_automated_purchase.go | 3 ++- core/integration/steps/the_automated_puchase.go | 5 +---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/core/execution/spot/protocol_automated_purchase.go b/core/execution/spot/protocol_automated_purchase.go index 45ab3b3b4f..e8ef707237 100644 --- a/core/execution/spot/protocol_automated_purchase.go +++ b/core/execution/spot/protocol_automated_purchase.go @@ -338,7 +338,8 @@ func (m *Market) checkPAP(ctx context.Context) { return } // pap has expired - if !m.pap.readyToStop && !m.pap.config.ExpiryTimestamp.IsZero() && m.pap.config.ExpiryTimestamp.Before(m.timeService.GetTimeNow()) { + if !m.pap.readyToStop && m.pap.config.ExpiryTimestamp.Unix() > 0 && m.pap.config.ExpiryTimestamp.Before(m.timeService.GetTimeNow()) { + m.log.Info("protocol automated purchase has expired, going to stop", logging.String("ID", m.pap.ID)) m.stopPAP(ctx) } } diff --git a/core/integration/steps/the_automated_puchase.go b/core/integration/steps/the_automated_puchase.go index 5bb87399d0..c77786c211 100644 --- a/core/integration/steps/the_automated_puchase.go +++ b/core/integration/steps/the_automated_puchase.go @@ -74,10 +74,7 @@ func NewProtocolAutomatedPurchase(r apRow, config *market.Config) (*types.NewPro auctionPriceOracle, priceOracleBinding, _ := config.OracleConfigs.GetOracleDefinitionForCompositePrice(r.row.MustStr("price oracle")) expiry := r.row.MustI64("expiry timestamp") - var expiryTime time.Time - if expiry > 0 { - expiryTime = time.Unix(expiry, 0) - } + expiryTime := time.Unix(expiry, 0) priceOracle := datasource.FromOracleSpecProto(auctionPriceOracle)