erigon icon indicating copy to clipboard operation
erigon copied to clipboard

use functional options pattern for constructors in polygon/p2p, polygon/sync, polygon/heimdall

Open taratorio opened this issue 1 year ago • 0 comments

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.

taratorio avatar Jul 04 '24 17:07 taratorio