forked from TrueCloudLab/frostfs-node
[#1437] ir: Fix contextcheck linters
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
parent
16598553d9
commit
6921a89061
27 changed files with 165 additions and 157 deletions
|
@ -48,8 +48,8 @@ func (s *Server) SetEpochDuration(val uint64) {
|
|||
}
|
||||
|
||||
// IsActive is a getter for a global active flag state.
|
||||
func (s *Server) IsActive() bool {
|
||||
return s.InnerRingIndex() >= 0
|
||||
func (s *Server) IsActive(ctx context.Context) bool {
|
||||
return s.InnerRingIndex(ctx) >= 0
|
||||
}
|
||||
|
||||
// IsAlphabet is a getter for a global alphabet flag state.
|
||||
|
@ -59,10 +59,10 @@ func (s *Server) IsAlphabet() bool {
|
|||
|
||||
// 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) InnerRingIndex() int {
|
||||
func (s *Server) InnerRingIndex(ctx context.Context) int {
|
||||
index, err := s.statusIndex.InnerRingIndex()
|
||||
if err != nil {
|
||||
s.log.Error(context.Background(), logs.InnerringCantGetInnerRingIndex, zap.String("error", err.Error()))
|
||||
s.log.Error(ctx, logs.InnerringCantGetInnerRingIndex, zap.String("error", err.Error()))
|
||||
return -1
|
||||
}
|
||||
|
||||
|
@ -71,10 +71,10 @@ func (s *Server) InnerRingIndex() int {
|
|||
|
||||
// InnerRingSize is a getter for a global size of inner ring list. This value
|
||||
// paired with inner ring index.
|
||||
func (s *Server) InnerRingSize() int {
|
||||
func (s *Server) InnerRingSize(ctx context.Context) int {
|
||||
size, err := s.statusIndex.InnerRingSize()
|
||||
if err != nil {
|
||||
s.log.Error(context.Background(), logs.InnerringCantGetInnerRingSize, zap.String("error", err.Error()))
|
||||
s.log.Error(ctx, logs.InnerringCantGetInnerRingSize, zap.String("error", err.Error()))
|
||||
return 0
|
||||
}
|
||||
|
||||
|
@ -93,18 +93,18 @@ func (s *Server) AlphabetIndex() int {
|
|||
return int(index)
|
||||
}
|
||||
|
||||
func (s *Server) voteForSidechainValidator(prm governance.VoteValidatorPrm) error {
|
||||
func (s *Server) voteForSidechainValidator(ctx context.Context, prm governance.VoteValidatorPrm) error {
|
||||
validators := prm.Validators
|
||||
|
||||
index := s.InnerRingIndex()
|
||||
index := s.InnerRingIndex(ctx)
|
||||
if s.contracts.alphabet.indexOutOfRange(index) {
|
||||
s.log.Info(context.Background(), logs.InnerringIgnoreValidatorVoteNodeNotInAlphabetRange)
|
||||
s.log.Info(ctx, logs.InnerringIgnoreValidatorVoteNodeNotInAlphabetRange)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
if len(validators) == 0 {
|
||||
s.log.Info(context.Background(), logs.InnerringIgnoreValidatorVoteEmptyValidatorsList)
|
||||
s.log.Info(ctx, logs.InnerringIgnoreValidatorVoteEmptyValidatorsList)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
@ -129,7 +129,7 @@ func (s *Server) voteForSidechainValidator(prm governance.VoteValidatorPrm) erro
|
|||
s.contracts.alphabet.iterate(func(letter GlagoliticLetter, contract util.Uint160) {
|
||||
_, err := s.morphClient.NotaryInvoke(contract, s.feeConfig.SideChainFee(), nonce, vubP, voteMethod, epoch, validators)
|
||||
if err != nil {
|
||||
s.log.Warn(context.Background(), logs.InnerringCantInvokeVoteMethodInAlphabetContract,
|
||||
s.log.Warn(ctx, logs.InnerringCantInvokeVoteMethodInAlphabetContract,
|
||||
zap.Int8("alphabet_index", int8(letter)),
|
||||
zap.Uint64("epoch", epoch),
|
||||
zap.String("error", err.Error()))
|
||||
|
@ -141,9 +141,9 @@ func (s *Server) voteForSidechainValidator(prm governance.VoteValidatorPrm) erro
|
|||
|
||||
// VoteForSidechainValidator calls vote method on alphabet contracts with
|
||||
// the provided list of keys.
|
||||
func (s *Server) VoteForSidechainValidator(prm governance.VoteValidatorPrm) error {
|
||||
func (s *Server) VoteForSidechainValidator(ctx context.Context, prm governance.VoteValidatorPrm) error {
|
||||
sort.Sort(prm.Validators)
|
||||
return s.voteForSidechainValidator(prm)
|
||||
return s.voteForSidechainValidator(ctx, prm)
|
||||
}
|
||||
|
||||
// ResetEpochTimer resets the block timer that produces events to update epoch
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue