searchForPeers: Replace batchSize by batchPeriod. (#14704)
Rationale: Before this commit, the internal loop exited if: - the expected amount of peers is found, or, - the iterator returns `false` (exhaustion), or - `batchSize` iterations are done. The issue with the iterations count is, in case not enough peer are found AND `iterator.Next` always returns `true`, we don't control WHEN the loop is going to stop. The root cause is we don't control the time needed to run the `iterator.Next` function, which is a function of `devp2P (geth)`. The value of `batchSize (2000)` was chosen arbitrarily. It turns out the time needed to run `iterator.Next` can go from a few micro seconds to a few hundreds of milliseconds. ==> In small networks (example: E2E tests), it was possible for the loop not to exit during several dozen of seconds. With this commit, we replace the `batchSize` by a `batchPeriod`, ensuring the loop will never run longer than `batchPeriod`, even in a small network. Co-authored-by: Nishant Das <nishdas93@gmail.com>
Prysm: An Ethereum Consensus Implementation Written in Go
This is the core repository for Prysm, a Golang implementation of the Ethereum Consensus specification, developed by Offchain Labs. See the Changelog for details of the latest releases and upcoming breaking changes.
Getting Started
A detailed set of installation and usage instructions as well as breakdowns of each individual component are available in the official documentation portal. If you still have questions, feel free to stop by our Discord.
Staking on Mainnet
To participate in staking, you can join the official eth2 launchpad. The launchpad is the only recommended way to become a validator on mainnet. You can explore validator rewards/penalties via Bitfly's block explorer: beaconcha.in, and follow the latest blocks added to the chain on beaconscan.
Contributing
Branches
Prysm maintains two permanent branches:
- master: This points to the latest stable release. It is ideal for most users.
- develop: This is used for development, it contains the latest PRs. Developers should base their PRs on this branch.
Guide
Want to get involved? Check out our Contribution Guide to learn more!
License
GNU General Public License v3.0
