From 6ff6e5608268a5d293db99fa29fc11c9f09ad1d9 Mon Sep 17 00:00:00 2001 From: dtfiedler Date: Fri, 20 Dec 2024 16:40:00 -0600 Subject: [PATCH 1/2] fix(epochs): handle old epochs --- src/main.lua | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/main.lua b/src/main.lua index a5c38811..a28fbfd4 100644 --- a/src/main.lua +++ b/src/main.lua @@ -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", From 0605c24442678aa561e5141b960fad934ba41363 Mon Sep 17 00:00:00 2001 From: dtfiedler Date: Fri, 20 Dec 2024 16:41:50 -0600 Subject: [PATCH 2/2] chore(docs): update comment --- src/main.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.lua b/src/main.lua index a28fbfd4..1f523f3c 100644 --- a/src/main.lua +++ b/src/main.lua @@ -1928,7 +1928,7 @@ addEventingHandler( or epochs.getEpochIndexForTimestamp(msg.Timestamp) 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 + -- TODO: this is to support old epochs that have full array of prescribedObservers, we can remove after the new epochs are created if epoch.prescribedObservers and epoch.prescribedObservers[1]