diff --git a/network/ip_tracker.go b/network/ip_tracker.go index ed3935d4716..13f7133630d 100644 --- a/network/ip_tracker.go +++ b/network/ip_tracker.go @@ -59,7 +59,7 @@ func newIPTracker( bloomMetrics: bloomMetrics, connected: make(map[ids.NodeID]*ips.ClaimedIPPort), mostRecentValidatorIPs: make(map[ids.NodeID]*ips.ClaimedIPPort), - gossipableIndicies: make(map[ids.NodeID]int), + gossipableIndices: make(map[ids.NodeID]int), bloomAdditions: make(map[ids.NodeID]int), } err = utils.Err( @@ -92,8 +92,8 @@ type ipTracker struct { // - The node is a validator // - The node is connected // - The IP the node connected with is its latest IP - gossipableIndicies map[ids.NodeID]int - gossipableIPs []*ips.ClaimedIPPort + gossipableIndices map[ids.NodeID]int + gossipableIPs []*ips.ClaimedIPPort // The bloom filter contains the most recent validator IPs to avoid // unnecessary IP gossip. @@ -288,13 +288,13 @@ func (i *ipTracker) updateMostRecentValidatorIP(ip *ips.ClaimedIPPort) { } func (i *ipTracker) addGossipableIP(ip *ips.ClaimedIPPort) { - i.gossipableIndicies[ip.NodeID] = len(i.gossipableIPs) + i.gossipableIndices[ip.NodeID] = len(i.gossipableIPs) i.gossipableIPs = append(i.gossipableIPs, ip) i.numGossipable.Inc() } func (i *ipTracker) removeGossipableIP(nodeID ids.NodeID) { - indexToRemove, wasGossipable := i.gossipableIndicies[nodeID] + indexToRemove, wasGossipable := i.gossipableIndices[nodeID] if !wasGossipable { return } @@ -302,11 +302,11 @@ func (i *ipTracker) removeGossipableIP(nodeID ids.NodeID) { newNumGossipable := len(i.gossipableIPs) - 1 if newNumGossipable != indexToRemove { replacementIP := i.gossipableIPs[newNumGossipable] - i.gossipableIndicies[replacementIP.NodeID] = indexToRemove + i.gossipableIndices[replacementIP.NodeID] = indexToRemove i.gossipableIPs[indexToRemove] = replacementIP } - delete(i.gossipableIndicies, nodeID) + delete(i.gossipableIndices, nodeID) i.gossipableIPs[newNumGossipable] = nil i.gossipableIPs = i.gossipableIPs[:newNumGossipable] i.numGossipable.Dec() diff --git a/network/ip_tracker_test.go b/network/ip_tracker_test.go index da088f4aae9..0bfda448c72 100644 --- a/network/ip_tracker_test.go +++ b/network/ip_tracker_test.go @@ -37,7 +37,7 @@ func requireEqual(t *testing.T, expected, actual *ipTracker) { require.Equal(expected.connected, actual.connected) require.Equal(expected.mostRecentValidatorIPs, actual.mostRecentValidatorIPs) require.Equal(expected.validators, actual.validators) - require.Equal(expected.gossipableIndicies, actual.gossipableIndicies) + require.Equal(expected.gossipableIndices, actual.gossipableIndices) require.Equal(expected.gossipableIPs, actual.gossipableIPs) require.Equal(expected.bloomAdditions, actual.bloomAdditions) require.Equal(expected.maxBloomCount, actual.maxBloomCount) @@ -82,7 +82,7 @@ func TestIPTracker_ManuallyTrack(t *testing.T) { tracker.Connected(ip) tracker.mostRecentValidatorIPs[ip.NodeID] = ip tracker.bloomAdditions[ip.NodeID] = 1 - tracker.gossipableIndicies[ip.NodeID] = 0 + tracker.gossipableIndices[ip.NodeID] = 0 tracker.gossipableIPs = []*ips.ClaimedIPPort{ ip, } @@ -235,7 +235,7 @@ func TestIPTracker_AddIP(t *testing.T) { tracker.Connected(ip) tracker.mostRecentValidatorIPs[newerIP.NodeID] = newerIP tracker.bloomAdditions[newerIP.NodeID] = 2 - delete(tracker.gossipableIndicies, newerIP.NodeID) + delete(tracker.gossipableIndices, newerIP.NodeID) tracker.gossipableIPs = tracker.gossipableIPs[:0] return tracker }(), @@ -283,7 +283,7 @@ func TestIPTracker_Connected(t *testing.T) { tracker.connected[ip.NodeID] = ip tracker.mostRecentValidatorIPs[ip.NodeID] = ip tracker.bloomAdditions[ip.NodeID] = 1 - tracker.gossipableIndicies[ip.NodeID] = 0 + tracker.gossipableIndices[ip.NodeID] = 0 tracker.gossipableIPs = []*ips.ClaimedIPPort{ ip, } @@ -323,7 +323,7 @@ func TestIPTracker_Connected(t *testing.T) { tracker.connected[newerIP.NodeID] = newerIP tracker.mostRecentValidatorIPs[newerIP.NodeID] = newerIP tracker.bloomAdditions[newerIP.NodeID] = 2 - tracker.gossipableIndicies[newerIP.NodeID] = 0 + tracker.gossipableIndices[newerIP.NodeID] = 0 tracker.gossipableIPs = []*ips.ClaimedIPPort{ newerIP, } @@ -344,7 +344,7 @@ func TestIPTracker_Connected(t *testing.T) { tracker.onValidatorAdded(ip.NodeID) require.True(t, tracker.AddIP(ip)) tracker.connected[ip.NodeID] = ip - tracker.gossipableIndicies[ip.NodeID] = 0 + tracker.gossipableIndices[ip.NodeID] = 0 tracker.gossipableIPs = []*ips.ClaimedIPPort{ ip, } @@ -392,7 +392,7 @@ func TestIPTracker_Disconnected(t *testing.T) { tracker.onValidatorAdded(ip.NodeID) tracker.Connected(ip) delete(tracker.connected, ip.NodeID) - delete(tracker.gossipableIndicies, ip.NodeID) + delete(tracker.gossipableIndices, ip.NodeID) tracker.gossipableIPs = tracker.gossipableIPs[:0] return tracker }(), @@ -415,7 +415,7 @@ func TestIPTracker_Disconnected(t *testing.T) { tracker.onValidatorAdded(otherIP.NodeID) tracker.Connected(otherIP) delete(tracker.connected, ip.NodeID) - tracker.gossipableIndicies = map[ids.NodeID]int{ + tracker.gossipableIndices = map[ids.NodeID]int{ otherIP.NodeID: 0, } tracker.gossipableIPs = []*ips.ClaimedIPPort{ @@ -479,7 +479,7 @@ func TestIPTracker_OnValidatorAdded(t *testing.T) { tracker.validators.Add(ip.NodeID) tracker.mostRecentValidatorIPs[ip.NodeID] = ip tracker.bloomAdditions[ip.NodeID] = 1 - tracker.gossipableIndicies[ip.NodeID] = 0 + tracker.gossipableIndices[ip.NodeID] = 0 tracker.gossipableIPs = []*ips.ClaimedIPPort{ ip, } @@ -554,7 +554,7 @@ func TestIPTracker_OnValidatorRemoved(t *testing.T) { tracker.Connected(ip) delete(tracker.mostRecentValidatorIPs, ip.NodeID) tracker.validators.Remove(ip.NodeID) - delete(tracker.gossipableIndicies, ip.NodeID) + delete(tracker.gossipableIndices, ip.NodeID) tracker.gossipableIPs = tracker.gossipableIPs[:0] return tracker }(), @@ -578,7 +578,7 @@ func TestIPTracker_OnValidatorRemoved(t *testing.T) { tracker.Connected(otherIP) delete(tracker.mostRecentValidatorIPs, ip.NodeID) tracker.validators.Remove(ip.NodeID) - tracker.gossipableIndicies = map[ids.NodeID]int{ + tracker.gossipableIndices = map[ids.NodeID]int{ otherIP.NodeID: 0, } tracker.gossipableIPs = []*ips.ClaimedIPPort{ diff --git a/vms/platformvm/txs/add_permissionless_delegator_tx_test.go b/vms/platformvm/txs/add_permissionless_delegator_tx_test.go index d7483f5ba60..152706391aa 100644 --- a/vms/platformvm/txs/add_permissionless_delegator_tx_test.go +++ b/vms/platformvm/txs/add_permissionless_delegator_tx_test.go @@ -525,7 +525,7 @@ func TestAddPermissionlessPrimaryDelegatorSerialization(t *testing.T) { 0x00, 0x00, 0x00, 0x05, // amount 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - // number of signature indicies + // number of signature indices 0x00, 0x00, 0x00, 0x00, // memo length 0x00, 0x00, 0x00, 0x14, @@ -1281,7 +1281,7 @@ func TestAddPermissionlessSubnetDelegatorSerialization(t *testing.T) { 0x00, 0x00, 0x00, 0x05, // amount 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - // number of signature indicies + // number of signature indices 0x00, 0x00, 0x00, 0x00, // memo length 0x00, 0x00, 0x00, 0x14, diff --git a/vms/platformvm/txs/add_permissionless_validator_tx_test.go b/vms/platformvm/txs/add_permissionless_validator_tx_test.go index 96828c94c16..389f28b13e2 100644 --- a/vms/platformvm/txs/add_permissionless_validator_tx_test.go +++ b/vms/platformvm/txs/add_permissionless_validator_tx_test.go @@ -585,7 +585,7 @@ func TestAddPermissionlessPrimaryValidator(t *testing.T) { 0x00, 0x00, 0x00, 0x05, // amount 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - // number of signature indicies + // number of signature indices 0x00, 0x00, 0x00, 0x00, // memo length 0x00, 0x00, 0x00, 0x14, @@ -1272,7 +1272,7 @@ func TestAddPermissionlessSubnetValidator(t *testing.T) { 0x00, 0x00, 0x00, 0x05, // amount 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - // number of signature indicies + // number of signature indices 0x00, 0x00, 0x00, 0x00, // memo length 0x00, 0x00, 0x00, 0x14,