Skip to content

Commit

Permalink
StateQuery: Add the absolute slot number to SlotDetails
Browse files Browse the repository at this point in the history
  • Loading branch information
erikd committed Oct 19, 2021
1 parent e4e799f commit 531738a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
10 changes: 8 additions & 2 deletions cardano-sync/src/Cardano/Sync/StateQuery.hs
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,14 @@ querySlotDetails start absSlot = do
(absEpoch, slotInEpoch) <- slotToEpoch' absSlot
epochSize <- qryFromExpr $ EEpochSize (ELit absEpoch)
let time = relToUTCTime start absTime
-- Set sdCurrentTime below and over write that above.
pure $ SlotDetails time time absEpoch (EpochSlot slotInEpoch) epochSize
pure $ SlotDetails
{ sdSlotTime = time
, sdCurrentTime = time -- Corrected above in insertCurrentTime
, sdEpochNo = absEpoch
, sdSlotNo = absSlot
, sdEpochSlot = EpochSlot slotInEpoch
, sdEpochSize = epochSize
}

relToUTCTime :: SystemStart -> RelativeTime -> UTCTime
relToUTCTime (SystemStart start) (RelativeTime rel) = addUTCTime rel start
1 change: 1 addition & 0 deletions cardano-sync/src/Cardano/Sync/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ data SlotDetails = SlotDetails
{ sdSlotTime :: !UTCTime
, sdCurrentTime :: !UTCTime
, sdEpochNo :: !EpochNo
, sdSlotNo :: !SlotNo
, sdEpochSlot :: !EpochSlot
, sdEpochSize :: !EpochSize
} deriving (Eq, Show)
Expand Down

0 comments on commit 531738a

Please sign in to comment.