-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add NetworkByChainID function to return network and blockchain for registered ChainID #460
Conversation
if _, ok := chainIDs[k]; !ok { | ||
return 0, fmt.Errorf("chainID not registered for %s:%s", blockchain, network) | ||
return 0, fmt.Errorf("%w for %s:%s", ErrChainIDNotRegistered, blockchain, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Retrun NoChain constant?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NoChain has a Blockchain type, not ChainID.
|
||
var ErrChainIDNotRegistered = errors.New("chainID is not registered") | ||
|
||
var chainIDsLock sync.RWMutex |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@olomix Do we really need sync.RWMutex here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What other options do we have to guard concurrent access to global dict?
We can use sync.Map. But typed map with lock I like more.
No description provided.