Skip to content

Commit

Permalink
fix TODO: make method private
Browse files Browse the repository at this point in the history
addresses review comment #457 (comment)
  • Loading branch information
feuGeneA committed Aug 23, 2024
1 parent e586c92 commit e5d44b4
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions signature-aggregator/aggregator/aggregator.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ func (s *SignatureAggregator) CreateSignedMessage(
var signingSubnet ids.ID
var err error
// If signingSubnet is not set we default to the subnet of the source blockchain
sourceSubnet, err := s.GetSubnetID(unsignedMessage.SourceChainID)
sourceSubnet, err := s.getSubnetID(unsignedMessage.SourceChainID)
if err != nil {
return nil, fmt.Errorf(
"Source message subnet not found for chainID %s",
Expand Down Expand Up @@ -343,9 +343,7 @@ func (s *SignatureAggregator) CreateSignedMessage(
return nil, errNotEnoughSignatures
}

// TODO: consider making this function private. its only reference seems to be
// within this module.
func (s *SignatureAggregator) GetSubnetID(blockchainID ids.ID) (ids.ID, error) {
func (s *SignatureAggregator) getSubnetID(blockchainID ids.ID) (ids.ID, error) {
s.subnetsMapLock.RLock()
subnetID, ok := s.subnetIDsByBlockchainID[blockchainID]
s.subnetsMapLock.RUnlock()
Expand All @@ -357,13 +355,11 @@ func (s *SignatureAggregator) GetSubnetID(blockchainID ids.ID) (ids.ID, error) {
if err != nil {
return ids.ID{}, fmt.Errorf("source blockchain not found for chain ID %s", blockchainID)
}
s.SetSubnetID(blockchainID, subnetID)
s.setSubnetID(blockchainID, subnetID)
return subnetID, nil
}

// TODO: consider making this function private. its only reference seems to be
// within this module.
func (s *SignatureAggregator) SetSubnetID(blockchainID ids.ID, subnetID ids.ID) {
func (s *SignatureAggregator) setSubnetID(blockchainID ids.ID, subnetID ids.ID) {
s.subnetsMapLock.Lock()
s.subnetIDsByBlockchainID[blockchainID] = subnetID
s.subnetsMapLock.Unlock()
Expand Down

0 comments on commit e5d44b4

Please sign in to comment.