From 9f7270ea14c5a2ec5506f72f8501c2ffdbb1a599 Mon Sep 17 00:00:00 2001 From: Yondon Fu Date: Thu, 14 Mar 2024 20:52:12 +0000 Subject: [PATCH] core: Default transcode max price --- core/orchestrator.go | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/core/orchestrator.go b/core/orchestrator.go index c810fb5b53..4e7c6800d1 100644 --- a/core/orchestrator.go +++ b/core/orchestrator.go @@ -322,12 +322,14 @@ func (orch *orchestrator) priceInfo(sender ethcommon.Address, manifestID Manifes } } + transcodePrice := orch.node.GetBasePrice(sender.String()) + if transcodePrice == nil { + transcodePrice = orch.node.GetBasePrice("default") + } + var basePrice *big.Rat if caps == nil { - basePrice = orch.node.GetBasePrice(sender.String()) - if basePrice == nil { - basePrice = orch.node.GetBasePrice("default") - } + basePrice = transcodePrice } else { // The base price is the sum of the prices of individual capability + model ID pairs basePrice = big.NewRat(0, 1) @@ -349,6 +351,12 @@ func (orch *orchestrator) priceInfo(sender ethcommon.Address, manifestID Manifes } } } + + // If no priced capabilities were signaled by the broadcaster assume that they are requesting + // transcoding and set the base price to the transcode price + if basePrice.Cmp(big.NewRat(0, 1)) == 0 { + basePrice = transcodePrice + } } if !orch.node.AutoAdjustPrice {