Format and use autoproperty
MODIFY
WalletWasabi.Tests/ExtPubKeyExplorerTests.cs
WalletWasabi.Tests/ExtPubKeyExplorerTests.cs
@@ -119,7 +119,8 @@ namespace WalletWasabi.Tests
.SetP(20);
builder.AddEntries(scripts);
- return new FilterModel{
+ return new FilterModel
+ {
BlockHeight = 0,
BlockHash = new uint256(blockHash),
Filter = builder.Build()

MODIFY
WalletWasabi/Services/ExtPubKeyExplorer.cs
WalletWasabi/Services/ExtPubKeyExplorer.cs
@@ -10,18 +10,21 @@ namespace WalletWasabi.Services
{
public class ExtPubKeyExplorer
{
- private readonly FilterModel[] _filters;
+ public ExtPubKey ExtPubKey { get; set; }
- private ExtPubKey _extPubKey;
- private IEnumerator<byte[]> _generator;
+ public FilterModel[] Filters { get; }
+ public IEnumerator<byte[]> Generator { get; set; }
+ /// <summary>
+ /// WARNING: ONLY CHECKS CONFIRMED AND BECH32 KEYPATHS
+ /// </summary>
public ExtPubKeyExplorer(ExtPubKey extPubKey, IEnumerable<FilterModel> filters)
{
- _extPubKey = extPubKey;
+ ExtPubKey = extPubKey;
- _generator = DerivateNext().GetEnumerator();
- _filters = filters.Where(x=>x.Filter != null).ToArray();
- if(_filters.Length == 0)
+ Generator = DerivateNext().GetEnumerator();
+ Filters = filters.Where(x => x.Filter != null).ToArray();
+ if (Filters.Length == 0)
throw new ArgumentException(nameof(filters), "There is no filter to match.");
}
@@ -29,8 +32,8 @@ namespace WalletWasabi.Services
{
while (true)
{
- _generator.MoveNext();
- var cur = _generator.Current;
+ Generator.MoveNext();
+ var cur = Generator.Current;
if (!Match(cur))
yield return cur;
}
@@ -39,7 +42,7 @@ namespace WalletWasabi.Services
private bool Match(byte[] script)
{
var used = false;
- foreach (var filterModel in _filters)
+ foreach (var filterModel in Filters)
{
used = filterModel.Filter.Match(script, filterModel.FilterKey);
if (used)
@@ -53,7 +56,7 @@ namespace WalletWasabi.Services
var i = 0u;
while (true)
{
- var pubKey = _extPubKey.Derive(i++).PubKey;
+ var pubKey = ExtPubKey.Derive(i++).PubKey;
var bytes = pubKey.WitHash.ScriptPubKey.ToCompressedBytes();
yield return bytes;
}

Format and use autoproperty