Skip to content

Commit

Permalink
fix(epochs): handle old epochs
Browse files Browse the repository at this point in the history
  • Loading branch information
dtfiedler committed Dec 20, 2024
1 parent 19f19e8 commit 6ff6e56
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1926,7 +1926,18 @@ addEventingHandler(
function(msg)
local epochIndex = msg.Tags["Epoch-Index"] and tonumber(msg.Tags["Epoch-Index"])
or epochs.getEpochIndexForTimestamp(msg.Timestamp)
local prescribedObserversWithWeights = epochs.getPrescribedObserversWithWeightsForEpoch(epochIndex)
local epoch = epochs.getEpoch(epochIndex)
local prescribedObserversWithWeights
-- TODO: this is to support old epochs that have full array of prescribedObservers, we can remove after 14 epochs
if
epoch.prescribedObservers
and epoch.prescribedObservers[1]
and epoch.prescribedObservers[1].gatewayAddress
then
prescribedObserversWithWeights = epoch.prescribedObservers
else
prescribedObserversWithWeights = epochs.getPrescribedObserversWithWeightsForEpoch(epochIndex)
end
Send(msg, {
Target = msg.From,
Action = "Prescribed-Observers-Notice",
Expand Down

0 comments on commit 6ff6e56

Please sign in to comment.