erigon
erigon copied to clipboard
use functional options pattern for constructors in polygon/p2p, polygon/sync, polygon/heimdall
Do after: https://github.com/ledgerwatch/erigon/issues/11031
There are a bunch of private constructors in:
- polygon/p2p
- polygon/sync
- potentially others within the polygon/ package
That exist only because we need to pass different values than the defaults for tests, e.g:
- newBlockDownloader
- (scan the dirs for more)
This can be improved by using the functional options pattern: https://github.com/uber-go/guide/blob/master/style.md#functional-options.