Update NBitcoin w/ changes in GRFilters
This commit updates the NBitcoin version and makes the required
changes to adapt the code to the new filters version. Also, it
removes unused classes and methods.
MODIFY
WalletWasabi/Backend/Models/FilterModel.cs
WalletWasabi/Backend/Models/FilterModel.cs
@@ -26,11 +26,7 @@ namespace WalletWasabi.Backend.Models
if(Filter != null) // bech found here
{
builder.Append(":");
- builder.Append(Filter.N);
- builder.Append(":");
- builder.Append(Filter.Data.Length);
- builder.Append(":");
- builder.Append(ByteHelpers.ToHex(Filter.Data.ToByteArray()));
+ builder.Append(Filter.ToString());
}
return builder.ToString();
@@ -52,17 +48,11 @@ namespace WalletWasabi.Backend.Models
}
else
{
- var n = int.Parse(parts[1]);
- var fba = new FastBitArray(ByteHelpers.FromHex(parts[3]));
- fba.Length = int.Parse(parts[2]);
-
- var filter = new GolombRiceFilter(fba, n);
-
return new FilterModel
{
BlockHeight = Guard.NotNull(nameof(height), height),
BlockHash = new uint256(parts[0]),
- Filter = filter
+ Filter = GolombRiceFilter.Parse(parts[1])
};
}
}

MODIFY
WalletWasabi/Extensions/NBitcoinExtensions.cs
WalletWasabi/Extensions/NBitcoinExtensions.cs
@@ -8,14 +8,6 @@ namespace NBitcoin
{
public static class NBitcoinExtensions
{
- public static byte[] ToByteArray(this FastBitArray me)
- {
- var byteCount = me.Length==0 ? 0 : (me.Length-1)/ 8 + 1;
- var bytes = new byte[byteCount];
- me.CopyTo(bytes, 0);
- return bytes;
- }
-
public static TxoRef ToTxoRef(this OutPoint me) => new TxoRef(me);
public static IEnumerable<TxoRef> ToTxoRefs(this TxInList me)

MODIFY
WalletWasabi/Services/IndexBuilderService.cs
WalletWasabi/Services/IndexBuilderService.cs
@@ -319,7 +319,10 @@ namespace WalletWasabi.Services
GolombRiceFilter filter = null;
if (scripts.Count != 0)
{
- filter = GolombRiceFilter.Build(key, scripts.Select(x => x.ToCompressedBytes()));
+ filter = new GolombRiceFilterBuilder()
+ .SetKey(block.GetHash())
+ .AddEntries(scripts.Select(x => x.ToCompressedBytes()))
+ .Build();
}
var filterModel = new FilterModel

MODIFY
WalletWasabi/Services/IndexDownloader.cs
WalletWasabi/Services/IndexDownloader.cs
@@ -38,11 +38,11 @@ namespace WalletWasabi.Services
{
if (network == Network.Main)
{
- return FilterModel.FromLine("0000000000000000001c8018d9cb3b742ef25114f27563e3fc4a1902167f9893:2:43:11288322B003", GetStartingHeight(network));
+ return FilterModel.FromLine("0000000000000000001c8018d9cb3b742ef25114f27563e3fc4a1902167f9893:0211288322B003", GetStartingHeight(network));
}
else if (network == Network.TestNet)
{
- return FilterModel.FromLine("00000000000f0d5edcaeba823db17f366be49a80d91d15b77747c2e017b8c20a:1:21:6E081E", GetStartingHeight(network));
+ return FilterModel.FromLine("00000000000f0d5edcaeba823db17f366be49a80d91d15b77747c2e017b8c20a:016E081E", GetStartingHeight(network));
}
else if (network == Network.RegTest)
{

MODIFY
WalletWasabi/WalletWasabi.csproj
WalletWasabi/WalletWasabi.csproj
<ItemGroup>
<PackageReference Include="ConcurrentHashSet" Version="1.0.2" />
- <PackageReference Include="NBitcoin" Version="4.1.1.5" />
+ <PackageReference Include="NBitcoin" Version="4.1.1.7" />
<PackageReference Include="Nito.AsyncEx.Coordination" Version="1.0.2" />
<PackageReference Include="Portable.BouncyCastle" Version="1.8.2" />
</ItemGroup>

Update NBitcoin w/ changes in GRFilters

This commit updates the NBitcoin version and makes the required
changes to adapt the code to the new filters version. Also, it
removes unused classes and methods.