@@ -162,10 +162,10 @@ func (client *FastUpdatesClient) GetCurrentFeedIds() ([]provider.FeedId, error)
162162 }
163163
164164 feedIds := make ([]provider.FeedId , len (rawFeedIs ))
165- for i , price := range rawFeedIs {
165+ for i , feedId := range rawFeedIs {
166166 feedIds [i ] = provider.FeedId {
167- Category : price [0 ],
168- Name : strings .TrimRight (string (price [1 :]), "\x00 " ),
167+ Category : feedId [0 ],
168+ Name : strings .TrimRight (string (feedId [1 :]), "\x00 " ),
169169 }
170170 }
171171
@@ -233,16 +233,27 @@ func (client *FastUpdatesClient) SubmitUpdates(updateProof *sortition.UpdateProo
233233}
234234
235235func (client * FastUpdatesClient ) getOnlineOfflineValues () ([]int , []float64 , []float64 , error ) {
236- providerRawValues , err := client .valuesProvider .GetValues (client .allFeeds )
236+ // Attempt to fetch values for active feeds only. The all feeds list returned by the smart contract may contain
237+ // delisted feed ids marked as 0x0 (the entries are kept to not affect indexing).
238+ var activeFeeds []provider.FeedId
239+ var activeFeedIndexes []int
240+ for i , feedId := range client .allFeeds {
241+ if feedId .Name != "" {
242+ activeFeeds = append (activeFeeds , feedId )
243+ activeFeedIndexes = append (activeFeedIndexes , i )
244+ }
245+ }
246+
247+ providerRawValues , err := client .valuesProvider .GetValues (activeFeeds )
237248 if err != nil {
238249 return nil , nil , nil , errors .Wrap (err , "error getting feed values" )
239250 }
240251
241- supportedFeedIndexes := []int {}
242- providerValues := []float64 {}
252+ var supportedFeedIndexes []int
253+ var providerValues []float64
243254 for i , value := range providerRawValues {
244255 if value != nil {
245- supportedFeedIndexes = append (supportedFeedIndexes , i )
256+ supportedFeedIndexes = append (supportedFeedIndexes , activeFeedIndexes [ i ] )
246257 providerValues = append (providerValues , * value )
247258 }
248259 }
0 commit comments