Skip to content
Snippets Groups Projects
Commit 7ac17cce authored by Miguel Montes's avatar Miguel Montes
Browse files

Corrección de bug en código de votación (no votaba si estaba en Tally)

parent a6a9b4e8
No related branches found
No related tags found
No related merge requests found
......@@ -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]]
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment