Test non-matching height
MODIFY
WalletWasabi.Tests/UnitTests/IndexStoreTests.cs
WalletWasabi.Tests/UnitTests/IndexStoreTests.cs
@@ -151,11 +151,20 @@ namespace WalletWasabi.Tests.UnitTests
Assert.True(File.Exists(matureFilters)); // mature filters are ok
- var nonMatchingFilter = new FilterModel(new SmartHeader(new uint256(2), new uint256(1), 1, MinutesAgo(30)), dummyFilter);
+ var nonMatchingBlockHashFilter = new FilterModel(new SmartHeader(new uint256(2), new uint256(1), 1, MinutesAgo(30)), dummyFilter);
+ await indexStore.AddNewFiltersAsync(new[]{ nonMatchingBlockHashFilter }, CancellationToken.None);
+ Assert.Equal(new uint256(3), headersChain.TipHash); // the filter is nor added!
+ Assert.Equal(2u, headersChain.TipHeight);
- await indexStore.AddNewFiltersAsync(new[] { nonMatchingFilter }, CancellationToken.None);
+ var nonMatchingHeightFilter = new FilterModel(new SmartHeader(new uint256(4), new uint256(3), 37, MinutesAgo(1)), dummyFilter);
+ await indexStore.AddNewFiltersAsync(new[]{ nonMatchingHeightFilter }, CancellationToken.None);
Assert.Equal(new uint256(3), headersChain.TipHash); // the filter is nor added!
Assert.Equal(2u, headersChain.TipHeight);
+
+ var correctFilter = new FilterModel(new SmartHeader(new uint256(4), new uint256(3), 3, MinutesAgo(1)), dummyFilter);
+ await indexStore.AddNewFiltersAsync(new[]{ correctFilter }, CancellationToken.None);
+ Assert.Equal(new uint256(4), headersChain.TipHash); // the filter is nor added!
+ Assert.Equal(3u, headersChain.TipHeight);
}
private async Task<(string, string, string)> GetIndexStorePathsAsync()

Test non-matching height