From 59f624043c5ea278cdf3690c63587706731ec572 Mon Sep 17 00:00:00 2001 From: Anton Kaliaev Date: Wed, 4 Jul 2018 20:50:36 +0400 Subject: [PATCH] reorder statements --- state/execution.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/state/execution.go b/state/execution.go index 941053316..601abec9e 100644 --- a/state/execution.go +++ b/state/execution.go @@ -284,18 +284,18 @@ func updateValidators(currentSet *types.ValidatorSet, abciUpdates []abci.Validat address := valUpdate.Address _, val := currentSet.GetByAddress(address) - if val == nil && valUpdate.VotingPower != 0 { - // add val - added := currentSet.Add(valUpdate) - if !added { - return fmt.Errorf("Failed to add new validator %v", valUpdate) - } - } else if valUpdate.VotingPower == 0 { + if valUpdate.VotingPower == 0 { // remove val _, removed := currentSet.Remove(address) if !removed { return fmt.Errorf("Failed to remove validator %X", address) } + } else if val == nil { + // add val + added := currentSet.Add(valUpdate) + if !added { + return fmt.Errorf("Failed to add new validator %v", valUpdate) + } } else { // update val updated := currentSet.Update(valUpdate)