From 33f4b58911cb2e3623caabc2e0b4757823654090 Mon Sep 17 00:00:00 2001 From: John | Elite Encoder Date: Wed, 8 May 2024 00:51:20 -0400 Subject: [PATCH] Remove -pricePerUnit requirement for orchestrator with -AIWorker flag --- cmd/livepeer/starter/starter.go | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/cmd/livepeer/starter/starter.go b/cmd/livepeer/starter/starter.go index e612732a08..11ed25fa75 100755 --- a/cmd/livepeer/starter/starter.go +++ b/cmd/livepeer/starter/starter.go @@ -873,19 +873,16 @@ func StartLivepeer(ctx context.Context, cfg LivepeerConfig) { if *cfg.Orchestrator { // Set price per pixel base info - if *cfg.PixelsPerUnit <= 0 { - // Can't divide by 0 - panic(fmt.Errorf("-pixelsPerUnit must be > 0, provided %d", *cfg.PixelsPerUnit)) - } - if cfg.PricePerUnit == nil { - // Prevent orchestrators from unknowingly providing free transcoding + if cfg.PricePerUnit == nil && *cfg.AIWorker == false { panic(fmt.Errorf("-pricePerUnit must be set")) + } else if cfg.PricePerUnit != nil { + if *cfg.PricePerUnit < 0 { + panic(fmt.Errorf("-pricePerUnit must be >= 0, provided %d", *cfg.PricePerUnit)) + } + + n.SetBasePrice("default", big.NewRat(int64(*cfg.PricePerUnit), int64(*cfg.PixelsPerUnit))) + glog.Infof("Price: %d wei for %d pixels\n ", *cfg.PricePerUnit, *cfg.PixelsPerUnit) } - if *cfg.PricePerUnit < 0 { - panic(fmt.Errorf("-pricePerUnit must be >= 0, provided %d", *cfg.PricePerUnit)) - } - n.SetBasePrice("default", big.NewRat(int64(*cfg.PricePerUnit), int64(*cfg.PixelsPerUnit))) - glog.Infof("Price: %d wei for %d pixels\n ", *cfg.PricePerUnit, *cfg.PixelsPerUnit) if *cfg.PricePerBroadcaster != "" { ppb := getBroadcasterPrices(*cfg.PricePerBroadcaster)