mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-08 21:08:10 -05:00
only initialize kzg if it will be used (#12803)
Co-authored-by: Kasey Kirkham <kasey@users.noreply.github.com>
This commit is contained in:
@@ -103,9 +103,12 @@ type blobNotifier struct {
|
||||
// NewService instantiates a new block service instance that will
|
||||
// be registered into a running beacon node.
|
||||
func NewService(ctx context.Context, opts ...Option) (*Service, error) {
|
||||
err := kzg.Start()
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "could not initialize go-kzg context")
|
||||
var err error
|
||||
if params.DenebEnabled() {
|
||||
err = kzg.Start()
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "could not initialize go-kzg context")
|
||||
}
|
||||
}
|
||||
ctx, cancel := context.WithCancel(ctx)
|
||||
bn := &blobNotifier{
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
package params
|
||||
|
||||
import (
|
||||
"math"
|
||||
"time"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
@@ -275,3 +276,10 @@ func (b *BeaconChainConfig) PreviousEpochAttestationsLength() uint64 {
|
||||
func (b *BeaconChainConfig) CurrentEpochAttestationsLength() uint64 {
|
||||
return uint64(b.SlotsPerEpoch.Mul(b.MaxAttestations))
|
||||
}
|
||||
|
||||
// DenebEnabled centralizes the check to determine if code paths
|
||||
// that are specific to deneb should be allowed to execute. This will make it easier to find call sites that do this
|
||||
// kind of check and remove them post-deneb.
|
||||
func DenebEnabled() bool {
|
||||
return BeaconConfig().DenebForkEpoch < math.MaxUint64
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user