mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-12-12 11:10:35 +00:00
core: fix Neo.Blockchain.GetValidators implementation
It should return keys, attempting to push []*state.Validator to the stack would probably lead to failure.
This commit is contained in:
parent
9e94895bb0
commit
80b8b50f02
1 changed files with 8 additions and 1 deletions
|
@ -236,7 +236,14 @@ func (ic *interopContext) witnessGetVerificationScript(v *vm.VM) error {
|
|||
|
||||
// bcGetValidators returns validators.
|
||||
func (ic *interopContext) bcGetValidators(v *vm.VM) error {
|
||||
validators := ic.dao.GetValidators()
|
||||
valStates := ic.dao.GetValidators()
|
||||
if len(valStates) > vm.MaxArraySize {
|
||||
return errors.New("too many validators")
|
||||
}
|
||||
validators := make([]vm.StackItem, 0, len(valStates))
|
||||
for _, val := range valStates {
|
||||
validators = append(validators, vm.NewByteArrayItem(val.PublicKey.Bytes()))
|
||||
}
|
||||
v.Estack().PushVal(validators)
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue