-
Notifications
You must be signed in to change notification settings - Fork 175
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Access] Do not return not found for tx result when collection not indexed #4454
Conversation
Codecov Report
@@ Coverage Diff @@
## master #4454 +/- ##
==========================================
- Coverage 54.16% 54.15% -0.02%
==========================================
Files 888 888
Lines 83743 83754 +11
==========================================
- Hits 45358 45354 -4
- Misses 34865 34884 +19
+ Partials 3520 3516 -4
Flags with carried forward coverage won't be shown. Click here to find out more.
|
@@ -273,16 +277,19 @@ func (b *backendTransactions) GetTransactionResult( | |||
|
|||
// access node may not have the block if it hasn't yet been finalized, hence block can be nil at this point | |||
if block != nil { | |||
blockID = block.ID() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can keep this, so that only compute blockID once
// if the request included a blockID or collectionID in its the search criteria, not found | ||
// should result in an error because it's not possible to guarantee that the result found | ||
// is the correct one. | ||
if err != nil && (blockID != flow.ZeroID || collectionID != flow.ZeroID) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we simply this condition? or break it into multiple if checks? it's too complex.
…dexed (#4454) * [Access] Do not return not found for tx result when collection not indexed * address review feedback
A change was added recently to support searching for tx results by block and collection. This had a bug where if transaction was included in a block, but the block had not yet been fully indexed,
GetTransactionResult
would return aNotFound
error with the messagenot found: could not retrieve collection: key not found
. Normally, the api would return a result, but the status would be pending.This PR update the endpoint to only return
NotFound
in this situation if the request include the blockID or collectionID as search criteria.