@@ -46,15 +46,24 @@ func NewNodeStatusUpdateWorker(c *core.Context, interval time.Duration) cron.Wor
4646// NewNodePricesUpdateWorker creates a worker that periodically updates the node's prices on the blockchain.
4747// The worker computes the current quote prices using the OracleClient and broadcasts a MsgUpdateNodeDetailsRequest.
4848func NewNodePricesUpdateWorker (c * core.Context , interval time.Duration ) cron.Worker {
49- handlerFunc := func (ctx context.Context ) error {
49+ handlerFunc := func (ctx context.Context ) ( err error ) {
5050 client := c .OracleClient ()
5151 if client == nil {
5252 return nil
5353 }
5454
55- var gigabytePrices v1.Prices
55+ var (
56+ prices v1.Prices
57+ gigabytePrices v1.Prices
58+ hourlyPrices v1.Prices
59+ )
5660
57- for _ , price := range c .SanitizedGigabytePrices (ctx ) {
61+ prices , err = c .SanitizedGigabytePrices (ctx )
62+ if err != nil {
63+ return fmt .Errorf ("sanitizing gigabyte prices: %w" , err )
64+ }
65+
66+ for _ , price := range prices {
5867 price , err := price .UpdateQuoteValue (ctx , client .GetQuotePrice )
5968 if err != nil {
6069 return fmt .Errorf ("updating quote price for denom %q: %w" , price .Denom , err )
@@ -63,9 +72,12 @@ func NewNodePricesUpdateWorker(c *core.Context, interval time.Duration) cron.Wor
6372 gigabytePrices = gigabytePrices .Add (price )
6473 }
6574
66- var hourlyPrices v1.Prices
75+ prices , err = c .SanitizedHourlyPrices (ctx )
76+ if err != nil {
77+ return fmt .Errorf ("sanitizing hourly prices: %w" , err )
78+ }
6779
68- for _ , price := range c . SanitizedHourlyPrices ( ctx ) {
80+ for _ , price := range prices {
6981 price , err := price .UpdateQuoteValue (ctx , client .GetQuotePrice )
7082 if err != nil {
7183 return fmt .Errorf ("updating quote price for denom %q: %w" , price .Denom , err )
0 commit comments