Skip to content

Commit

Permalink
core: Default transcode max price
Browse files Browse the repository at this point in the history
  • Loading branch information
yondonfu committed Mar 14, 2024
1 parent 27a5a51 commit 9f7270e
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions core/orchestrator.go
Expand Up @@ -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)
Expand All @@ -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 {
Expand Down

0 comments on commit 9f7270e

Please sign in to comment.