From 6abe33467634711598d3c08930a20f415fe847e0 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Fri, 25 Dec 2020 14:45:24 +0300 Subject: [PATCH] [#33] netmap: Do not save ballots for invalid epoch Signed-off-by: Alex Vanin --- netmap/netmap_contract.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/netmap/netmap_contract.go b/netmap/netmap_contract.go index b510851..e4c495c 100644 --- a/netmap/netmap_contract.go +++ b/netmap/netmap_contract.go @@ -219,6 +219,11 @@ func NewEpoch(epochNum int) bool { panic("newEpoch: this method must be invoked by inner ring nodes") } + currentEpoch := storage.Get(ctx, snapshotEpoch).(int) + if epochNum <= currentEpoch { + return false // ignore invocations with invalid epoch + } + data0snapshot := getSnapshot(ctx, snapshot0Key) dataOnlineState := filterNetmap(ctx, onlineState)