[#446] innerring: Rename server.Index to server.InnerRingIndex

With different indexes for inner ring list and alphabet list this
is the better naming.

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
Alex Vanin 2021-03-23 17:14:28 +03:00 committed by Alex Vanin
parent 80bfd08a47
commit cd21641dfc
5 changed files with 8 additions and 8 deletions

View file

@ -10,7 +10,7 @@ import (
)
func (np *Processor) processEmit() {
index := np.irList.Index()
index := np.irList.InnerRingIndex()
if index < 0 {
np.log.Info("passive mode, ignore gas emission event")

View file

@ -12,7 +12,7 @@ import (
type (
// Indexer is a callback interface for inner ring global state.
Indexer interface {
Index() int
InnerRingIndex() int
}
// Contracts is an interface of the storage

View file

@ -21,7 +21,7 @@ import (
type (
// Indexer is a callback interface for inner ring global state.
Indexer interface {
Index() int
InnerRingIndex() int
InnerRingSize() int
}

View file

@ -27,7 +27,7 @@ func (ap *Processor) selectContainersToAudit(epoch uint64) ([]*container.ID, err
return strings.Compare(containers[i].String(), containers[j].String()) < 0
})
ind := ap.irList.Index()
ind := ap.irList.InnerRingIndex()
irSize := ap.irList.InnerRingSize()
if ind < 0 || ind >= irSize {

View file

@ -21,12 +21,12 @@ func (s *Server) SetEpochCounter(val uint64) {
// IsActive is a getter for a global active flag state.
func (s *Server) IsActive() bool {
return s.Index() >= 0
return s.InnerRingIndex() >= 0
}
// Index is a getter for a global index of node in inner ring list. Negative
// InnerRingIndex is a getter for a global index of node in inner ring list. Negative
// index means that node is not in the inner ring list.
func (s *Server) Index() int {
func (s *Server) InnerRingIndex() int {
index, err := s.statusIndex.InnerRingIndex()
if err != nil {
s.log.Error("can't get inner ring index", zap.String("error", err.Error()))
@ -49,7 +49,7 @@ func (s *Server) InnerRingSize() int {
}
func (s *Server) voteForSidechainValidator(validators []keys.PublicKey) error {
index := s.Index()
index := s.InnerRingIndex()
if s.contracts.alphabet.indexOutOfRange(index) {
s.log.Info("ignore validator vote: node not in alphabet range")