Remove list of onion addresses
MODIFY
WalletWasabi.Documentation/ClientDeployment.md
WalletWasabi.Documentation/ClientDeployment.md
4. Set description use [previous releases](https://github.com/molnard/WalletWasabi/releases) as a template.
5. Add the Release Notes, the same as it will be at the final release (can be typofixed).
6. Make sure local .NET Core version is up to date.
-7. Update the onion seed list to the most reliable ones: in packager run `dotnet run -- --reduceonions`.
-8. Set the version number in the software but only increase the rev number by one to avoid version collision like: 1.1.6.4.
-9. Run tests.
-10. Run packager in publish mode.
-11. Create `.msi`.
-12. Run packager in sign mode. (Set back to publish mode)
-13. Test asc file for `.msi`.
-14. Final `.msi` test on own computer.
-15. Upload the files to the pre-release.
-16. Check `This is a pre-release` and press Publish Release.
-17. Add the pre-release link to the Final Test issue.
-18. Share the Final Test issue link with developers an test it for 24 hours.
-19. Every PR which is contained in the release must be at least 24 hours old.
+7. Set the version number in the software but only increase the rev number by one to avoid version collision like: 1.1.6.4.
+8. Run tests.
+9. Run packager in publish mode.
+10. Create `.msi`.
+11. Run packager in sign mode. (Set back to publish mode)
+12. Test asc file for `.msi`.
+13. Final `.msi` test on own computer.
+14. Upload the files to the pre-release.
+15. Check `This is a pre-release` and press Publish Release.
+16. Add the pre-release link to the Final Test issue.
+17. Share the Final Test issue link with developers an test it for 24 hours.
+18. Every PR which is contained in the release must be at least 24 hours old.
# 3. Packaging
0. Make sure local .NET Core version is up to date.
-1. Update the onion seed list to the most reliable ones: `dotnet run -- --reduceonions`.
-2. Run tests.
-3. Retest every PR since last release on Windows, macOS and Linux.
-4. Bump client version. (WalletWasabi/Helpers/Constants.cs, WalletWasabi.Backend\wwwroot\index.html).
-5. Run packager in publish mode.
-6. [mac sign] Copy Wasabi-osx-version.zip to [macOS release environment](https://github.com/zkSNACKs/WalletWasabi/blob/master/WalletWasabi.Documentation/Guides/MacOsSigning.md) desktop.
-7. [mac sign] Run the packager on macOS.
-8. [mac sign] Copy the final dmg back to dist folder on windows.
-9. Create `.msi`.
-10. Run packager in sign mode. (Set back to publish mode)
-11. Final `.msi` test on own computer.
+1. Run tests.
+2. Retest every PR since last release on Windows, macOS and Linux.
+3. Bump client version. (WalletWasabi/Helpers/Constants.cs, WalletWasabi.Backend\wwwroot\index.html).
+4. Run packager in publish mode.
+5. [mac sign] Copy Wasabi-osx-version.zip to [macOS release environment](https://github.com/zkSNACKs/WalletWasabi/blob/master/WalletWasabi.Documentation/Guides/MacOsSigning.md) desktop.
+6. [mac sign] Run the packager on macOS.
+7. [mac sign] Copy the final dmg back to dist folder on windows.
+8. Create `.msi`.
+9. Run packager in sign mode. (Set back to publish mode)
+10. Final `.msi` test on own computer.
# 4. GitHub Release

MODIFY
WalletWasabi.Packager/ArgsProcessor.cs
WalletWasabi.Packager/ArgsProcessor.cs
@@ -14,12 +14,8 @@ namespace WalletWasabi.Packager
public string[] Args { get; }
- public bool IsReduceOnionsMode() => IsOneOf("reduceonions", "reduceonion");
-
public bool IsOnlyBinariesMode() => IsOneOf("onlybinaries");
- public bool IsGetOnionsMode() => IsOneOf("getonions", "getonion");
-
public bool IsContinuousDeliveryMode() => IsOneOf("cdelivery");
private bool IsOneOf(params string[] values)

DELETE
WalletWasabi.Packager/BitnodesApi.cs
-using NBitcoin.Protocol;
-using Newtonsoft.Json;
-using Newtonsoft.Json.Linq;
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Net;
-using System.Net.Http;
-using System.Threading.Tasks;
-
-namespace WalletWasabi.Packager
-{
- /// <summary>
- /// Implementation for Bitnodes API.
- /// </summary>
- /// <seealso href="https://bitnodes.io/api/"/>
- public class BitnodesApi
- {
- /// <summary>v2 onion services are always 16 characters long.</summary>
- private const int OnionV2AddressLength = 16;
-
- /// <summary>Prefix that is used by Bitcoin Core clients to identify themselves.</summary>
- private const string BitcoinCoreClientUserAgentPrefix = "Satoshi:";
-
- public BitnodesApi(TextWriter textWriter)
- {
- TextWriter = textWriter;
- }
-
- private TextWriter TextWriter { get; }
-
- /// <inheritdoc cref="PrintOnionsAsync(HashSet{string}?)"/>
- public async Task PrintOnionsAsync()
- {
- await PrintOnionsAsync(currentOnions: null).ConfigureAwait(false);
- }
-
- /// <summary>
- /// Finds all Bitcoin nodes that:
- /// <list type="bullet">
- /// <item>run as v2 onion services, and</item>
- /// <item>run Bitcoin Core 0.16+ client, and</item>
- /// <item>support witness data, and</item>
- /// <item>provide <see cref="NodeServices.Network"/>.</item>
- /// </list>
- /// Consequently, it sorts them by node names and writes them to <see cref="TextWriter"/>.
- /// </summary>
- /// <param name="currentOnions">A set of Bitcoin node names containing ".onion".</param>
- /// <remarks>Allows to pre-define a set of Bitcoin node names containing ".onion".</remarks>
- /// <returns><see cref="Task"/>.</returns>
- /// <seealso href="https://bitnodes.21.co/api/v1/snapshots/latest/"/>
- public async Task PrintOnionsAsync(HashSet<string>? currentOnions)
- {
- using var httpClient = new HttpClient();
- httpClient.BaseAddress = new Uri("https://bitnodes.21.co/api/v1/");
-
- // List all reachable nodes from a snapshot.
- // See https://bitnodes.io/api/#list-nodes.
- using var httpResponse = await httpClient.GetAsync("snapshots/latest/", HttpCompletionOption.ResponseContentRead).ConfigureAwait(false);
-
- if (httpResponse.StatusCode != HttpStatusCode.OK)
- {
- throw new HttpRequestException(httpResponse.StatusCode.ToString());
- }
-
- string response = await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
-
- ProcessResponse(response, currentOnions);
- }
-
- /// <summary>
- /// Internal method. Use only in tests.
- /// </summary>
- /// <param name="currentOnions">A set of Bitcoin node names containing ".onion".</param>
- public void ProcessResponse(string response, HashSet<string>? currentOnions)
- {
- JObject json = (JObject)JsonConvert.DeserializeObject(response);
-
- var onions = new List<string>();
- foreach (JProperty node in json["nodes"])
- {
- // 1) Check onion service version.
- //
- // This is to filter only onion v2 services which are 16 characters long, whereas
- // onion v3 addresses are 56 characters long.
- if (node.Name.IndexOf(".onion") != OnionV2AddressLength)
- {
- continue;
- }
-
- JArray value = ((JArray)node.Value);
-
- // 2) Check node services
- ulong services = value[3].Value<ulong>();
-
- // 2.a) Is witness-ready? If not, skip.
- if ((services & (ulong)NodeServices.NODE_WITNESS) == 0)
- {
- continue;
- }
-
- // 2.b) Is full node with whole blockchain? If not, skip.
- if ((services & (ulong)NodeServices.Network) == 0)
- {
- continue;
- }
-
- // 3) Accept only Bitcoin Core nodes with version >=0.16.
- try
- {
- string userAgent = value[1].Value<string>();
-
- // Parse "major.minor" part of version. As Bitcoin Core versions are in form "0.xx.<something>",
- // the version part is represented by 4 characters.
- string satoshiClientVersion = userAgent.Substring(userAgent.IndexOf(BitcoinCoreClientUserAgentPrefix) + "Satoshi:".Length, length: 4);
- var version = new Version(satoshiClientVersion);
- bool addToResult = currentOnions is null || currentOnions.Contains(node.Name);
-
- if (version >= new Version("0.16") && addToResult)
- {
- onions.Add(node.Name);
- }
- }
- catch
- {
- continue;
- }
- }
-
- foreach (var onion in onions.OrderBy(x => x))
- {
- TextWriter.WriteLine(onion);
- }
- }
- }
-}

MODIFY
WalletWasabi.Packager/Program.cs
WalletWasabi.Packager/Program.cs
@@ -68,26 +68,6 @@ namespace WalletWasabi.Packager
return;
}
- // If I want a list of up to date onions run it with '--getonions'.
- if (argsProcessor.IsGetOnionsMode())
- {
- var api = new BitnodesApi(Console.Out);
- await api.PrintOnionsAsync();
-
- return;
- }
-
- // If I want a list of up to date onions run it with '--reduceonions'.
- if (argsProcessor.IsReduceOnionsMode())
- {
- string onionFilePath = Path.Combine(LibraryProjectDirectory, "Tor", "OnionSeeds", "MainOnionSeeds.txt");
- var currentOnions = File.ReadAllLines(onionFilePath).ToHashSet();
-
- var api = new BitnodesApi(Console.Out);
- await api.PrintOnionsAsync(currentOnions);
-
- return;
- }
// Only binaries mode is for deterministic builds.
OnlyBinaries = argsProcessor.IsOnlyBinariesMode();

MODIFY
WalletWasabi.Tests/UnitTests/Packager/ArgsProcessorTests.cs
WalletWasabi.Tests/UnitTests/Packager/ArgsProcessorTests.cs
@@ -8,17 +8,6 @@ namespace WalletWasabi.Tests.UnitTests.Packager
/// </summary>
public class ArgsProcessorTests
{
- [Theory]
- [InlineData(new string[] { "-reduceonions" }, true)]
- [InlineData(new string[] { "-reduceOnions" }, true)]
- [InlineData(new string[] { "----reduceOnions" }, true)]
- [InlineData(new string[] { "-reduce0nions" }, false)]
- public void IsReduceOnionsModeTest(string[] input, bool expectedResult)
- {
- var argsProcessor = new ArgsProcessor(input);
- Assert.Equal(expectedResult, argsProcessor.IsReduceOnionsMode());
- }
-
[Theory]
[InlineData(new string[] { "-onlybinaries" }, true)]
[InlineData(new string[] { "-onlyBinaries" }, true)]

DELETE
WalletWasabi.Tests/UnitTests/Packager/BitnodesApiTests.cs
-using System;
-using System.Collections.Generic;
-using System.IO;
-using WalletWasabi.Packager;
-using Xunit;
-
-namespace WalletWasabi.Tests.UnitTests.Packager
-{
- /// <summary>
- /// Tests for <see cref="BitnodesApi"/>.
- /// </summary>
- public class BitnodesApiTests
- {
- private const string ApiResponse = @"
- {
- ""timestamp"": 1597669414,
- ""total_nodes"": 10407,
- ""latest_height"": 644147,
- ""nodes"": {
- ""tg4uwrjmtr2jlbjy.onion:8333"": [ 70015, ""/Satoshi:0.19.0.1/"", 1597459201, 1033, 0, null, null, null, 0, 0, null, ""TOR"", ""Tor network"" ],
- ""nesxfmano25clfvn.onion:8333"": [ 70015, ""/Satoshi:0.20.0/"", 1597596093, 1037, 644124, null, null, null, 0, 0, null, ""TOR"", ""Tor network"" ],
- ""tep3ddikbopezl4v.onion:8333"": [ 70015, ""/Satoshi:0.19.0.1/"", 1597621378, 1032, 0, null, null, null, 0, 0, null, ""TOR"", ""Tor network"" ],
- ""185.25.48.184:8333"": [ 70015, ""/Satoshi:0.19.0.1/"", 1590754138, 1037, 644147, ""4832-10449.bacloud.info"", null, ""LT"", 56, 24, ""Europe/Vilnius"", ""AS61272"", ""Informacines sistemos ir technologijos, UAB"" ]
- }
- }";
-
- /// <summary>
- /// Tests that we process response from Bitnodes API correctly.
- /// </summary>
- [Fact]
- public void ProcessResponseTest()
- {
- var stringWriter = new StringWriter();
- var api = new BitnodesApi(stringWriter);
- api.ProcessResponse(ApiResponse, currentOnions: null);
-
- // tep3ddikbopezl4v.onion is skipped because it is not a full node.
- Assert.Equal($"nesxfmano25clfvn.onion:8333{Environment.NewLine}tg4uwrjmtr2jlbjy.onion:8333{Environment.NewLine}", stringWriter.ToString());
- }
-
- /// <summary>
- /// Tests reduce onions behavior where we set <c>currentOnions</c> and addresses that do not fulfill
- /// parameters are filtered out.
- /// </summary>
- /// <seealso cref="BitnodesApi.PrintOnionsAsync(HashSet{string}?)"/>
- [Fact]
- public void ProcessResponseWithCurrentOnionsTest()
- {
- var currentOnions = new HashSet<string>()
- {
- "tg4uwrjmtr2jlbjy.onion:8333", // Fulfills all criteria.
- "tep3ddikbopezl4v.onion:8333", // This one is not a full node, so it should not be in the result.
- "185.25.48.184:8333", // Not an onion address.
- };
-
- var stringWriter = new StringWriter();
- var api = new BitnodesApi(stringWriter);
- api.ProcessResponse(ApiResponse, currentOnions);
-
- // tep3ddikbopezl4v.onion is skipped because it is not a full node.
- Assert.Equal($"tg4uwrjmtr2jlbjy.onion:8333{Environment.NewLine}", stringWriter.ToString());
- }
- }
-}

Remove list of onion addresses