diff --git a/process/scQueryProcessor.go b/process/scQueryProcessor.go index 3cdeb9b1..24508ac5 100644 --- a/process/scQueryProcessor.go +++ b/process/scQueryProcessor.go @@ -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 } @@ -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 +}