Skip to content
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

TryRemoveLastFilterIfNewerThanAsync should not throw #12778

Merged
merged 2 commits into from
Apr 10, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions WalletWasabi/Stores/IndexStore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -317,14 +317,14 @@ public async Task<FilterModel[]> FetchBatchAsync(uint fromHeight, int batchSize,
{
if (!IndexStorage.TryRemoveLast(out filter))
{
throw new InvalidOperationException("No last filter.");
return null;
Copy link
Collaborator

@kiminuo kiminuo Apr 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this is important when there are no blocks in the database, right?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there was some history about why we throw the exception but I can't recall why we did it and given the method's name and what it does I would expect the method NOT to throw, so I think it's a good change.

}
}
else
{
if (!IndexStorage.TryRemoveLastIfNewerThan(height.Value, out filter))
{
throw new InvalidOperationException("No last filter.");
return null;
}
}

Expand Down