fix expecatation
MODIFY
WalletWasabi.Tests/IntegrationTests/RegTests.cs
WalletWasabi.Tests/IntegrationTests/RegTests.cs
@@ -292,7 +292,7 @@ namespace WalletWasabi.Tests.IntegrationTests
var filter = filters[i];
Assert.Equal(i, (int)filter.Header.Height);
Assert.Equal(expectedHash, filter.Header.BlockHash);
- Assert.Equal("01053a58", filter.Filter.ToString());
+ Assert.Equal(IndexBuilderService.CreateDummyEmptyFilter(expectedHash).ToString(), filter.Filter.ToString());
}
}
finally
@@ -402,7 +402,7 @@ namespace WalletWasabi.Tests.IntegrationTests
Assert.Equal(expectedHash, filter.Header.BlockHash);
if (i < 101) // Later other tests may fill the filter.
{
- Assert.Equal("01053a58", filter.Filter.ToString());
+ Assert.Equal(IndexBuilderService.CreateDummyEmptyFilter(expectedHash).ToString(), filter.Filter.ToString());
}
}

MODIFY
WalletWasabi/Blockchain/BlockFilters/IndexBuilderService.cs
WalletWasabi/Blockchain/BlockFilters/IndexBuilderService.cs
@@ -21,6 +21,17 @@ namespace WalletWasabi.Blockchain.BlockFilters
public class IndexBuilderService
{
public static byte[][] DummyScript { get; } = new byte[][] { ByteHelpers.FromHex("0009BBE4C2D17185643765C265819BF5261755247D") };
+
+ public static GolombRiceFilter CreateDummyEmptyFilter(uint256 blockHash)
+ {
+ return new GolombRiceFilterBuilder()
+ .SetKey(blockHash)
+ .SetP(20)
+ .SetM(1 << 20)
+ .AddEntries(DummyScript)
+ .Build();
+ }
+
public RPCClient RpcClient { get; }
public BlockNotifier BlockNotifier { get; }
public string IndexFilePath { get; }
@@ -253,12 +264,7 @@ namespace WalletWasabi.Blockchain.BlockFilters
{
// We cannot have empty filters, because there was a bug in GolombRiceFilterBuilder that evaluates empty filters to true.
// And this must be fixed in a backwards compatible way, so we create a fake filter with a random scp instead.
- filter = new GolombRiceFilterBuilder()
- .SetKey(block.GetHash())
- .SetP(20)
- .SetM(1 << 20)
- .AddEntries(DummyScript)
- .Build();
+ filter = CreateDummyEmptyFilter(block.GetHash());
}
var smartHeader = new SmartHeader(block.GetHash(), block.Header.HashPrevBlock, heightToRequest, block.Header.BlockTime);

MODIFY
WalletWasabi/Blockchain/BlockFilters/StartingFilters.cs
WalletWasabi/Blockchain/BlockFilters/StartingFilters.cs
@@ -24,12 +24,7 @@ namespace WalletWasabi.Blockchain.BlockFilters
}
else if (network == Network.RegTest)
{
- var filter = new GolombRiceFilterBuilder()
- .SetKey(startingHeader.BlockHash)
- .SetP(20)
- .SetM(1 << 20)
- .AddEntries(IndexBuilderService.DummyScript)
- .Build();
+ GolombRiceFilter filter = IndexBuilderService.CreateDummyEmptyFilter(startingHeader.BlockHash);
return FilterModel.FromLine($"{startingHeader.Height}:{startingHeader.BlockHash}:{filter.ToString()}:{startingHeader.PrevHash}:{startingHeader.BlockTime.ToUnixTimeSeconds()}");
}
else

fix expecatation