core: fix Registered state descriptor processing
It has simple boolean value encoded, no `strconv` needed (it actually chokes on such input).
This commit is contained in:
parent
141553da4c
commit
38d0efc96c
1 changed files with 4 additions and 6 deletions
|
@ -5,7 +5,6 @@ import (
|
||||||
"math"
|
"math"
|
||||||
"math/big"
|
"math/big"
|
||||||
"sort"
|
"sort"
|
||||||
"strconv"
|
|
||||||
"sync"
|
"sync"
|
||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
"time"
|
"time"
|
||||||
|
@ -684,12 +683,11 @@ func processValidatorStateDescriptor(descriptor *transaction.StateDescriptor, da
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if descriptor.Field == "Registered" {
|
if descriptor.Field == "Registered" {
|
||||||
isRegistered, err := strconv.ParseBool(string(descriptor.Value))
|
if len(descriptor.Value) == 1 {
|
||||||
if err != nil {
|
validatorState.Registered = descriptor.Value[0] != 0
|
||||||
return err
|
return dao.PutValidatorState(validatorState)
|
||||||
}
|
}
|
||||||
validatorState.Registered = isRegistered
|
return errors.New("bad descriptor value")
|
||||||
return dao.PutValidatorState(validatorState)
|
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue