diff --git a/balance/balance_contract.go b/balance/balance_contract.go index 1a6d05e..a5cdad2 100644 --- a/balance/balance_contract.go +++ b/balance/balance_contract.go @@ -413,6 +413,11 @@ func vote(ctx storage.Context, id, from []byte) int { for i := 0; i < len(candidates); i++ { cnd := candidates[i] + + if blockHeight-cnd.block > blockDiff { + continue + } + if bytesEqual(cnd.id, id) { voters := cnd.n @@ -427,10 +432,7 @@ func vote(ctx storage.Context, id, from []byte) int { found = len(voters) } - // do not add old ballots, they are invalid - if blockHeight-cnd.block <= blockDiff { - newCandidates = append(newCandidates, cnd) - } + newCandidates = append(newCandidates, cnd) } if found < 0 { diff --git a/container/container_contract.go b/container/container_contract.go index adfdb83..b684f6b 100644 --- a/container/container_contract.go +++ b/container/container_contract.go @@ -502,6 +502,11 @@ func vote(ctx storage.Context, id, from []byte) int { for i := 0; i < len(candidates); i++ { cnd := candidates[i] + + if blockHeight-cnd.block > blockDiff { + continue + } + if bytesEqual(cnd.id, id) { voters := cnd.n @@ -516,10 +521,7 @@ func vote(ctx storage.Context, id, from []byte) int { found = len(voters) } - // do not add old ballots, they are invalid - if blockHeight-cnd.block <= blockDiff { - newCandidates = append(newCandidates, cnd) - } + newCandidates = append(newCandidates, cnd) } if found < 0 { diff --git a/neofs/neofs_contract.go b/neofs/neofs_contract.go index a6851df..223f4ad 100644 --- a/neofs/neofs_contract.go +++ b/neofs/neofs_contract.go @@ -556,6 +556,11 @@ func vote(ctx storage.Context, id, from []byte) int { for i := 0; i < len(candidates); i++ { cnd := candidates[i] + + if blockHeight-cnd.block > blockDiff { + continue + } + if bytesEqual(cnd.id, id) { voters := cnd.n @@ -570,10 +575,7 @@ func vote(ctx storage.Context, id, from []byte) int { found = len(voters) } - // do not add old ballots, they are invalid - if blockHeight-cnd.block <= blockDiff { - newCandidates = append(newCandidates, cnd) - } + newCandidates = append(newCandidates, cnd) } if found < 0 { diff --git a/neofsid/neofsid_contract.go b/neofsid/neofsid_contract.go index 4708271..ce44de6 100644 --- a/neofsid/neofsid_contract.go +++ b/neofsid/neofsid_contract.go @@ -231,6 +231,11 @@ func vote(ctx storage.Context, id, from []byte) int { for i := 0; i < len(candidates); i++ { cnd := candidates[i] + + if blockHeight-cnd.block > blockDiff { + continue + } + if bytesEqual(cnd.id, id) { voters := cnd.n @@ -245,10 +250,7 @@ func vote(ctx storage.Context, id, from []byte) int { found = len(voters) } - // do not add old ballots, they are invalid - if blockHeight-cnd.block <= blockDiff { - newCandidates = append(newCandidates, cnd) - } + newCandidates = append(newCandidates, cnd) } if found < 0 { diff --git a/netmap/netmap_contract.go b/netmap/netmap_contract.go index bd29daf..5cc9b21 100644 --- a/netmap/netmap_contract.go +++ b/netmap/netmap_contract.go @@ -431,6 +431,11 @@ func vote(ctx storage.Context, id, from []byte) int { for i := 0; i < len(candidates); i++ { cnd := candidates[i] + + if blockHeight-cnd.block > blockDiff { + continue + } + if bytesEqual(cnd.id, id) { voters := cnd.n @@ -445,10 +450,7 @@ func vote(ctx storage.Context, id, from []byte) int { found = len(voters) } - // do not add old ballots, they are invalid - if blockHeight-cnd.block <= blockDiff { - newCandidates = append(newCandidates, cnd) - } + newCandidates = append(newCandidates, cnd) } if found < 0 {