forked from TrueCloudLab/neoneo-go
native: don't expose internal slices to the outside world
They should be hidden.
This commit is contained in:
parent
7eef895061
commit
579630a3fa
1 changed files with 2 additions and 2 deletions
|
@ -388,13 +388,13 @@ func (n *NEO) getRegisteredValidatorsCall(ic *interop.Context, _ []stackitem.Ite
|
||||||
// GetValidatorsInternal returns a list of current validators.
|
// GetValidatorsInternal returns a list of current validators.
|
||||||
func (n *NEO) GetValidatorsInternal(bc blockchainer.Blockchainer, d dao.DAO) (keys.PublicKeys, error) {
|
func (n *NEO) GetValidatorsInternal(bc blockchainer.Blockchainer, d dao.DAO) (keys.PublicKeys, error) {
|
||||||
if vals := n.validators.Load().(keys.PublicKeys); vals != nil {
|
if vals := n.validators.Load().(keys.PublicKeys); vals != nil {
|
||||||
return vals, nil
|
return vals.Copy(), nil
|
||||||
}
|
}
|
||||||
standByValidators := bc.GetStandByValidators()
|
standByValidators := bc.GetStandByValidators()
|
||||||
si := d.GetStorageItem(n.ContractID, validatorsCountKey)
|
si := d.GetStorageItem(n.ContractID, validatorsCountKey)
|
||||||
if si == nil {
|
if si == nil {
|
||||||
n.validators.Store(standByValidators)
|
n.validators.Store(standByValidators)
|
||||||
return standByValidators, nil
|
return standByValidators.Copy(), nil
|
||||||
}
|
}
|
||||||
validatorsCount, err := ValidatorsCountFromBytes(si.Value)
|
validatorsCount, err := ValidatorsCountFromBytes(si.Value)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in a new issue