From 7ac17cce1610bfd392fca305223bd140df4bbfad Mon Sep 17 00:00:00 2001 From: Miguel Montes <miguel.montes@gmail.com> Date: Tue, 4 Dec 2018 16:24:08 -0300 Subject: [PATCH] =?UTF-8?q?Correcci=C3=B3n=20de=20bug=20en=20c=C3=B3digo?= =?UTF-8?q?=20de=20votaci=C3=B3n=20(no=20votaba=20si=20estaba=20en=20Tally?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bfa_client/src/client/bfa_client.go | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/bfa_client/src/client/bfa_client.go b/bfa_client/src/client/bfa_client.go index f3f25ac..7be848f 100644 --- a/bfa_client/src/client/bfa_client.go +++ b/bfa_client/src/client/bfa_client.go @@ -331,19 +331,18 @@ func propose() { defer node.Close() util.Ensure(node.IsSealer(bfa.Self), "Solo los selladores pueden votar") votes := node.Votes(latest) - util.Ensure(flags.NArg() > 0, "No se especificaron candidatos por los cuales votar") + util.Ensure(flags.NArg() > 0, "No se especificaron candidatos por los cuales votar\n") for i := 0; i < flags.NArg(); i++ { address := flags.Arg(i) util.Ensure(util.IsAddress(address), "'%v' no es una dirección válida", address) - if _, ok := votes.Tally[address]; ok { - continue // address is in a proposal, so we allow voting either way - } - isSealer := util.Contains(votes.Signers, address) - switch { // address is not in a proposal, we allow removing signers or adding non signers - case isSealer && authorize: - util.Error("'%v' ya es un sellador", address) - case !isSealer && !authorize: - util.Error("'%v' no es un sellador", address) + if _, ok := votes.Tally[address]; !ok { + isSealer := util.Contains(votes.Signers, address) + switch { // address is not in a proposal, we only allow removing signers or adding non signers + case isSealer && authorize: + util.Error("'%v' ya es un sellador", address) + case !isSealer && !authorize: + util.Error("'%v' no es un sellador", address) + } } node.Propose(address, authorize) if json { @@ -448,11 +447,6 @@ func main() { validCommands = append(validCommands, cmd) } sort.Strings(validCommands) - //defer func() { - // if err := recover(); err != nil { - // log.Printf("Error: %s", err) - // } - //}() if len(os.Args) > 1 { command = commands[os.Args[1]] } -- GitLab