+
Skip to content

Conversation

olomix
Copy link
Contributor

@olomix olomix commented Jan 29, 2024

No description provided.

@olomix olomix requested review from Kolezhniuk and demonsh January 29, 2024 17:59
}
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,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Retrun NoChain constant?

Copy link
Contributor Author

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.

@olomix olomix requested a review from ilya-korotya January 29, 2024 18:13
@demonsh demonsh requested a review from vmidyllic January 30, 2024 12:22

var ErrChainIDNotRegistered = errors.New("chainID is not registered")

var chainIDsLock sync.RWMutex
Copy link
Contributor

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?

Copy link
Contributor Author

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.

@vmidyllic vmidyllic merged commit 56c19c5 into master Feb 1, 2024
@vmidyllic vmidyllic deleted the network_by_chainid branch February 1, 2024 10:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载