Skip to content

Commit

Permalink
fix after review
Browse files Browse the repository at this point in the history
  • Loading branch information
bogdan-rosianu committed Sep 21, 2023
1 parent a713a29 commit 394794c
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions process/scQueryProcessor.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ func (scQueryProcessor *SCQueryProcessor) ExecuteQuery(query *data.SCQuery) (*vm
return nil, data.BlockInfo{}, err
}

// TODO: if vm queries will allow historical block coordinates, adjust the data availability here
observers, err := scQueryProcessor.proc.GetObservers(shardID, data.AvailabilityRecent)
availability := getAvailabilityBasedOnVmQueryOptions(query)
observers, err := scQueryProcessor.proc.GetObservers(shardID, availability)
if err != nil {
return nil, data.BlockInfo{}, err
}
Expand Down Expand Up @@ -118,3 +118,11 @@ func (scQueryProcessor *SCQueryProcessor) createRequestFromQuery(query *data.SCQ
func (scQueryProcessor *SCQueryProcessor) IsInterfaceNil() bool {
return scQueryProcessor == nil
}

func getAvailabilityBasedOnVmQueryOptions(query *data.SCQuery) data.ObserverDataAvailabilityType {
availability := data.AvailabilityRecent
if query.BlockNonce.HasValue || len(query.BlockHash) > 0 {
availability = data.AvailabilityAll
}
return availability
}

0 comments on commit 394794c

Please sign in to comment.