Skip to content

Commit

Permalink
lint + timing
Browse files Browse the repository at this point in the history
  • Loading branch information
iansuvak committed Oct 2, 2024
1 parent fd69fe0 commit d54e3a1
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions peers/app_request_network.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,16 +222,18 @@ func (c *ConnectedCanonicalValidators) GetValidator(nodeID ids.NodeID) (*warp.Va

// ConnectToCanonicalValidators connects to the canonical validators of the given subnet and returns the connected
// validator information
func (n *appRequestNetwork) ConnectToCanonicalValidators(subnetID ids.ID, height uint64) (*ConnectedCanonicalValidators, error) {
func (n *appRequestNetwork) ConnectToCanonicalValidators(
subnetID ids.ID,
height uint64,
) (*ConnectedCanonicalValidators, error) {
var validatorSet []*warp.Validator
var totalValidatorWeight uint64
var err error

startPChainAPICall := time.Now()
if height == 0 {
// Get the subnet's current canonical validator set
startPChainAPICall := time.Now()
validatorSet, totalValidatorWeight, err = n.validatorClient.GetCurrentCanonicalValidatorSet(subnetID)
n.setPChainAPICallLatencyMS(float64(time.Since(startPChainAPICall).Milliseconds()))
if err != nil {
return nil, err
}
Expand All @@ -246,6 +248,8 @@ func (n *appRequestNetwork) ConnectToCanonicalValidators(subnetID ids.ID, height
return nil, err
}
}
n.setPChainAPICallLatencyMS(float64(time.Since(startPChainAPICall).Milliseconds()))

// We make queries to node IDs, not unique validators as represented by a BLS pubkey, so we need this map to track
// responses from nodes and populate the signatureMap with the corresponding validator signature
// This maps node IDs to the index in the canonical validator set
Expand Down

0 comments on commit d54e3a1

Please sign in to comment.