diff --git a/server/server.go b/server/server.go index 345e6936..e5105b72 100644 --- a/server/server.go +++ b/server/server.go @@ -110,7 +110,6 @@ func New(ctx context.Context, cfg config.Config) (*Server, error) { transport, service.WithConfig(cfg.Service), service.WithRoundConfig(cfg.Round), - service.WithPrivateKey(privateKey), ) if err != nil { return nil, fmt.Errorf("failed to create Service: %v", err) diff --git a/service/service.go b/service/service.go index 4e062470..b1856d25 100644 --- a/service/service.go +++ b/service/service.go @@ -32,8 +32,6 @@ type Service struct { roundCfg round_config.Config datadir string minMemoryLayer uint - - privKey ed25519.PrivateKey } type ClosedRound struct { @@ -54,12 +52,6 @@ type newServiceOption struct { type newServiceOptionFunc func(*newServiceOption) -func WithPrivateKey(privateKey ed25519.PrivateKey) newServiceOptionFunc { - return func(o *newServiceOption) { - o.privateKey = privateKey - } -} - func WithConfig(cfg Config) newServiceOptionFunc { return func(o *newServiceOption) { o.cfg = cfg @@ -88,14 +80,6 @@ func NewService( for _, opt := range opts { opt(options) } - if options.privateKey == nil { - logging.FromContext(ctx).Info("generating new private key") - _, privateKey, err := ed25519.GenerateKey(nil) - if err != nil { - return nil, fmt.Errorf("generating key: %w", err) - } - options.privateKey = privateKey - } estimatedLeaves := uint64(options.roundCfg.RoundDuration().Seconds()) * uint64(options.cfg.EstimatedLeavesPerSecond) minMemoryLayer := uint(0) @@ -116,12 +100,15 @@ func NewService( roundCfg: options.roundCfg, minMemoryLayer: minMemoryLayer, datadir: datadir, - privKey: options.privateKey, registration: registration, } - logging.FromContext(ctx). - Info("created poet worker service", zap.Binary("pubkey", s.privKey.Public().(ed25519.PublicKey)), zap.Time("genesis", s.genesis), zap.Uint("min memory layer", s.minMemoryLayer), zap.Object("round config", s.roundCfg)) + logging.FromContext(ctx).Info( + "created poet worker service", + zap.Time("genesis", s.genesis), + zap.Uint("min memory layer", s.minMemoryLayer), + zap.Object("round config", s.roundCfg), + ) return s, nil }