Skip to content

Commit

Permalink
fix(ai): fix offchain 'PriceFeedWatcher is not initialized' error
Browse files Browse the repository at this point in the history
This commit ensures that the `PriceFeedWatcher is not initialized` error
is not thrown when the software is run in `offchain` mode.
  • Loading branch information
rickstaa committed Jul 31, 2024
1 parent 71089b3 commit 2f95332
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
*.dll
*.so
*.dylib

# IDE files
*.vscode
*.code-workspace

# Test binary, build with `go test -c`
*.test
Expand Down
7 changes: 6 additions & 1 deletion cmd/livepeer/starter/starter.go
Original file line number Diff line number Diff line change
Expand Up @@ -1124,7 +1124,12 @@ func StartLivepeer(ctx context.Context, cfg LivepeerConfig) {
panic(fmt.Errorf("'pricePerUnit' value specified for model '%v' in pipeline '%v' must be >= 0, provided %v", config.ModelID, config.Pipeline, config.PricePerUnit))
}
pricePerPixel := new(big.Rat).Quo(pricePerUnit, pixelsPerUnit)
autoPrice, err := core.NewAutoConvertedPrice(currency, pricePerPixel, nil)
var autoPrice *core.AutoConvertedPrice
if *cfg.Network == "offchain" {
autoPrice = core.NewFixedPrice(pricePerPixel)
} else {
autoPrice, err = core.NewAutoConvertedPrice(currency, pricePerPixel, nil)
}
if err != nil {
panic(fmt.Errorf("error converting price: %v", err))
}
Expand Down

0 comments on commit 2f95332

Please sign in to comment.