MCPcopy Create free account
hub / github.com/DNAProject/DNA / getNextValidatorPID

Method getNextValidatorPID

txnpool/proc/txnpool_server.go:460–474  ·  view source on GitHub ↗

getNextValidatorPID returns the next pid with the verify type using roundRobin LB

(key types.VerifyType)

Source from the content-addressed store, hash-verified

458
459// getNextValidatorPID returns the next pid with the verify type using roundRobin LB
460func (s *TXPoolServer) getNextValidatorPID(key types.VerifyType) *actor.PID {
461 s.validators.Lock()
462 defer s.validators.Unlock()
463
464 length := len(s.validators.entries[key])
465 if length == 0 {
466 return nil
467 }
468
469 entries := s.validators.entries[key]
470 lastIdx := s.validators.state.state[key]
471 next := (lastIdx + 1) % length
472 s.validators.state.state[key] = next
473 return entries[next].Sender
474}
475
476// Stop stops server and workers.
477func (s *TXPoolServer) Stop() {

Callers 1

sendReq2StatefulVMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected