From b4e92ebd76ba8e2a09411d6cb510cc583c358d15 Mon Sep 17 00:00:00 2001 From: ffranr Date: Fri, 15 Nov 2024 14:29:42 +0000 Subject: [PATCH] rfqmsg: ensure Unix time conversion to time.Time uses UTC Set the converted `time.Time` to UTC when transforming from Unix time. This change promotes consistency and simplifies debugging. --- rfqmsg/buy_accept.go | 2 +- rfqmsg/buy_request.go | 2 +- rfqmsg/sell_request.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/rfqmsg/buy_accept.go b/rfqmsg/buy_accept.go index 7d1f97c20..25b196463 100644 --- a/rfqmsg/buy_accept.go +++ b/rfqmsg/buy_accept.go @@ -68,7 +68,7 @@ func newBuyAcceptFromWireMsg(wireMsg WireMessage, assetRate := msgData.InAssetRate.Val.IntoBigIntFixedPoint() // Convert the unix timestamp in seconds to a time.Time. - expiry := time.Unix(int64(msgData.Expiry.Val), 0) + expiry := time.Unix(int64(msgData.Expiry.Val), 0).UTC() return &BuyAccept{ Peer: wireMsg.Peer, diff --git a/rfqmsg/buy_request.go b/rfqmsg/buy_request.go index e01b9cd6e..9832a71f7 100644 --- a/rfqmsg/buy_request.go +++ b/rfqmsg/buy_request.go @@ -127,7 +127,7 @@ func NewBuyRequestFromWire(wireMsg WireMessage, return nil, fmt.Errorf("expiry time exceeds maximum int64") } - expiry := time.Unix(int64(msgData.Expiry.Val), 0) + expiry := time.Unix(int64(msgData.Expiry.Val), 0).UTC() // Extract the suggested asset to BTC rate if provided. var assetRateHint fn.Option[AssetRate] diff --git a/rfqmsg/sell_request.go b/rfqmsg/sell_request.go index 8c8c84d92..d0721337b 100644 --- a/rfqmsg/sell_request.go +++ b/rfqmsg/sell_request.go @@ -121,7 +121,7 @@ func NewSellRequestFromWire(wireMsg WireMessage, "request") } - expiry := time.Unix(int64(msgData.Expiry.Val), 0) + expiry := time.Unix(int64(msgData.Expiry.Val), 0).UTC() // Extract the suggested asset to BTC rate if provided. var assetRateHint fn.Option[AssetRate]