Skip to content

Commit

Permalink
Remove -pricePerUnit requirement for orchestrator with -AIWorker flag
Browse files Browse the repository at this point in the history
  • Loading branch information
eliteprox committed May 8, 2024
1 parent dfb4320 commit 33f4b58
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions cmd/livepeer/starter/starter.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 33f4b58

Please sign in to comment.