diff --git a/WalletWasabi.Backend/Global.cs b/WalletWasabi.Backend/Global.cs index 842b0a7bf1b..240b0aa2251 100644 --- a/WalletWasabi.Backend/Global.cs +++ b/WalletWasabi.Backend/Global.cs @@ -38,15 +38,15 @@ public Global(string dataDir, IRPCClient rpcClient, Config config) } // We have to find it, because it's cloned by the node and not perfectly cloned (event handlers cannot be cloned.) - P2pNode = new(config.Network, config.GetBitcoinP2pEndPoint(), new(), $"/WasabiCoordinator:{Constants.BackendMajorVersion}/"); - HostedServices.Register(() => new BlockNotifier(TimeSpan.FromSeconds(7), rpcClient, P2pNode), "Block Notifier"); + P2pNode = new(config.Network, config.GetBitcoinP2pEndPoint(), new()); + HostedServices.Register(() => new BlockNotifier(rpcClient, P2pNode), "Block Notifier"); // Initialize index building var indexBuilderServiceDir = Path.Combine(DataDir, "IndexBuilderService"); var indexFilePath = Path.Combine(indexBuilderServiceDir, $"Index{RpcClient.Network}.dat"); - IndexBuilderService = new(RpcClient, HostedServices.Get(), indexFilePath); + IndexBuilderService = new(RpcClient, HostedServices.Get()); - MempoolMirror = new MempoolMirror(TimeSpan.FromSeconds(21), RpcClient, P2pNode); + MempoolMirror = new MempoolMirror(RpcClient, P2pNode); } public string DataDir { get; } diff --git a/WalletWasabi.Daemon/Global.cs b/WalletWasabi.Daemon/Global.cs index e6acbc669c5..998a1c3705f 100644 --- a/WalletWasabi.Daemon/Global.cs +++ b/WalletWasabi.Daemon/Global.cs @@ -377,13 +377,13 @@ private async Task StartLocalBitcoinNodeAsync(CancellationToken cancel) private void RegisterLocalNodeDependentComponents(CoreNode coreNode) { - HostedServices.Register(() => new BlockNotifier(TimeSpan.FromSeconds(7), coreNode.RpcClient, coreNode.P2pNode), "Block Notifier"); + HostedServices.Register(() => new BlockNotifier(coreNode.RpcClient, coreNode.P2pNode), "Block Notifier"); HostedServices.Register(() => new RpcMonitor(TimeSpan.FromSeconds(7), coreNode.RpcClient), "RPC Monitor"); HostedServices.Register(() => new RpcFeeProvider(TimeSpan.FromMinutes(1), coreNode.RpcClient, HostedServices.Get()), "RPC Fee Provider"); if (!Config.BlockOnlyMode) { HostedServices.Register( - () => new MempoolMirror(TimeSpan.FromSeconds(21), coreNode.RpcClient, coreNode.P2pNode), + () => new MempoolMirror(coreNode.RpcClient, coreNode.P2pNode), "Full Node Mempool Mirror"); } } diff --git a/WalletWasabi.Tests/Helpers/ArenaBuilder.cs b/WalletWasabi.Tests/Helpers/ArenaBuilder.cs index 9a81c5e24e0..3330278507d 100644 --- a/WalletWasabi.Tests/Helpers/ArenaBuilder.cs +++ b/WalletWasabi.Tests/Helpers/ArenaBuilder.cs @@ -33,7 +33,7 @@ public Arena Create(params Round[] rounds) Network network = Network ?? Network.Main; RoundParameterFactory roundParameterFactory = RoundParameterFactory ?? CreateRoundParameterFactory(config, network); - Arena arena = new(period, config, rpc, prison, roundParameterFactory); + Arena arena = new(config, rpc, prison, roundParameterFactory, period:period); foreach (var round in rounds) { diff --git a/WalletWasabi.Tests/RegressionTests/BackendTests.cs b/WalletWasabi.Tests/RegressionTests/BackendTests.cs index 731025971ed..6e5996b478f 100644 --- a/WalletWasabi.Tests/RegressionTests/BackendTests.cs +++ b/WalletWasabi.Tests/RegressionTests/BackendTests.cs @@ -247,7 +247,7 @@ public async Task FilterBuilderTestAsync() var indexBuilderServiceDir = Helpers.Common.GetWorkDir(); var indexFilePath = Path.Combine(indexBuilderServiceDir, $"Index{rpc.Network}.dat"); - IndexBuilderService indexBuilderService = new(rpc, global.HostedServices.Get(), indexFilePath); + IndexBuilderService indexBuilderService = new(rpc, global.HostedServices.Get()); try { indexBuilderService.Synchronize(); diff --git a/WalletWasabi.Tests/UnitTests/BitcoinCore/IndexBuilderServiceTests.cs b/WalletWasabi.Tests/UnitTests/BitcoinCore/IndexBuilderServiceTests.cs index e2f91b3a14c..14c4e89237e 100644 --- a/WalletWasabi.Tests/UnitTests/BitcoinCore/IndexBuilderServiceTests.cs +++ b/WalletWasabi.Tests/UnitTests/BitcoinCore/IndexBuilderServiceTests.cs @@ -27,8 +27,8 @@ public async Task SegwitTaprootUnsynchronizedBitcoinNodeAsync() InitialBlockDownload = false }), }; - using var blockNotifier = new BlockNotifier(TimeSpan.MaxValue, rpc); - var indexer = new IndexBuilderService(rpc, blockNotifier, "filters.txt"); + using var blockNotifier = new BlockNotifier(rpc); + var indexer = new IndexBuilderService(rpc, blockNotifier); indexer.Synchronize(); @@ -54,8 +54,8 @@ public async Task SegwitTaprootStalledBitcoinNodeAsync() }); } }; - using var blockNotifier = new BlockNotifier(TimeSpan.MaxValue, rpc); - var indexer = new IndexBuilderService(rpc, blockNotifier, "filters.txt"); + using var blockNotifier = new BlockNotifier(rpc); + var indexer = new IndexBuilderService(rpc, blockNotifier); indexer.Synchronize(); @@ -85,8 +85,8 @@ public async Task SegwitTaprootSynchronizingBitcoinNodeAsync() OnGetBlockHashAsync = (height) => Task.FromResult(blockchain[height].Hash), OnGetVerboseBlockAsync = (hash) => Task.FromResult(blockchain.Single(x => x.Hash == hash)) }; - using var blockNotifier = new BlockNotifier(TimeSpan.MaxValue, rpc); - var indexer = new IndexBuilderService(rpc, blockNotifier, "filters.txt"); + using var blockNotifier = new BlockNotifier(rpc); + var indexer = new IndexBuilderService(rpc, blockNotifier); indexer.Synchronize(); @@ -155,8 +155,8 @@ public async Task SegwitTaprootSynchronizedBitcoinNodeAsync() OnGetBlockHashAsync = (height) => Task.FromResult(blockchain[height].Hash), OnGetVerboseBlockAsync = (hash) => Task.FromResult(blockchain.Single(x => x.Hash == hash)) }; - using var blockNotifier = new BlockNotifier(TimeSpan.MaxValue, rpc); - var indexer = new IndexBuilderService(rpc, blockNotifier, "filters.txt"); + using var blockNotifier = new BlockNotifier(rpc); + var indexer = new IndexBuilderService(rpc, blockNotifier); indexer.Synchronize(); @@ -181,8 +181,8 @@ public async Task TaprootUnsynchronizedBitcoinNodeAsync() InitialBlockDownload = false }), }; - using var blockNotifier = new BlockNotifier(TimeSpan.MaxValue, rpc); - var indexer = new IndexBuilderService(rpc, blockNotifier, "filters.txt"); + using var blockNotifier = new BlockNotifier(rpc); + var indexer = new IndexBuilderService(rpc, blockNotifier); indexer.Synchronize(); @@ -208,8 +208,8 @@ public async Task TaprootStalledBitcoinNodeAsync() }); } }; - using var blockNotifier = new BlockNotifier(TimeSpan.MaxValue, rpc); - var indexer = new IndexBuilderService(rpc, blockNotifier, "filters.txt"); + using var blockNotifier = new BlockNotifier(rpc); + var indexer = new IndexBuilderService(rpc, blockNotifier); indexer.Synchronize(); @@ -239,8 +239,8 @@ public async Task TaprootSynchronizingBitcoinNodeAsync() OnGetBlockHashAsync = (height) => Task.FromResult(blockchain[height].Hash), OnGetVerboseBlockAsync = (hash) => Task.FromResult(blockchain.Single(x => x.Hash == hash)) }; - using var blockNotifier = new BlockNotifier(TimeSpan.MaxValue, rpc); - var indexer = new IndexBuilderService(rpc, blockNotifier, "filters.txt"); + using var blockNotifier = new BlockNotifier(rpc); + var indexer = new IndexBuilderService(rpc, blockNotifier); indexer.Synchronize(); @@ -267,8 +267,8 @@ public async Task TaprootSynchronizedBitcoinNodeAsync() OnGetBlockHashAsync = (height) => Task.FromResult(blockchain[height].Hash), OnGetVerboseBlockAsync = (hash) => Task.FromResult(blockchain.Single(x => x.Hash == hash)) }; - using var blockNotifier = new BlockNotifier(TimeSpan.MaxValue, rpc); - var indexer = new IndexBuilderService(rpc, blockNotifier, "filters.txt"); + using var blockNotifier = new BlockNotifier(rpc); + var indexer = new IndexBuilderService(rpc, blockNotifier); indexer.Synchronize(); diff --git a/WalletWasabi.Tests/UnitTests/BitcoinCore/MempoolMirrorTests.cs b/WalletWasabi.Tests/UnitTests/BitcoinCore/MempoolMirrorTests.cs index d90f5c63670..e72f3624381 100644 --- a/WalletWasabi.Tests/UnitTests/BitcoinCore/MempoolMirrorTests.cs +++ b/WalletWasabi.Tests/UnitTests/BitcoinCore/MempoolMirrorTests.cs @@ -18,7 +18,7 @@ public async Task CanCopyMempoolFromRpcAsync() { var coreNode = await TestNodeBuilder.CreateAsync(); using HostedServices services = new(); - services.Register(() => new MempoolMirror(TimeSpan.FromSeconds(2), coreNode.RpcClient, coreNode.P2pNode), "Mempool Mirror"); + services.Register(() => new MempoolMirror(coreNode.RpcClient, coreNode.P2pNode, TimeSpan.FromSeconds(2)), "Mempool Mirror"); try { var rpc = coreNode.RpcClient; @@ -59,7 +59,7 @@ public async Task CanHandleArrivingTxAsync() { var coreNode = await TestNodeBuilder.CreateAsync(); using HostedServices services = new(); - services.Register(() => new MempoolMirror(TimeSpan.FromSeconds(7), coreNode.RpcClient, coreNode.P2pNode), "Mempool Mirror"); + services.Register(() => new MempoolMirror(coreNode.RpcClient, coreNode.P2pNode, TimeSpan.FromSeconds(7)), "Mempool Mirror"); try { var rpc = coreNode.RpcClient; @@ -97,7 +97,7 @@ public async Task CanHandleTheSameTxSentManyTimesAsync() { var coreNode = await TestNodeBuilder.CreateAsync(); using HostedServices services = new(); - services.Register(() => new MempoolMirror(TimeSpan.FromSeconds(2), coreNode.RpcClient, coreNode.P2pNode), "Mempool Mirror"); + services.Register(() => new MempoolMirror(coreNode.RpcClient, coreNode.P2pNode, TimeSpan.FromSeconds(2)), "Mempool Mirror"); try { var rpc = coreNode.RpcClient; @@ -150,7 +150,7 @@ public async Task CanHandleManyTxsAsync() { var coreNode = await TestNodeBuilder.CreateAsync(); using HostedServices services = new(); - services.Register(() => new MempoolMirror(TimeSpan.FromSeconds(2), coreNode.RpcClient, coreNode.P2pNode), "Mempool Mirror"); + services.Register(() => new MempoolMirror(coreNode.RpcClient, coreNode.P2pNode, TimeSpan.FromSeconds(2)), "Mempool Mirror"); try { var rpc = coreNode.RpcClient; @@ -196,7 +196,7 @@ public async Task CanHandleConfirmationAsync() { var coreNode = await TestNodeBuilder.CreateAsync(); using HostedServices services = new(); - services.Register(() => new MempoolMirror(TimeSpan.FromSeconds(2), coreNode.RpcClient, coreNode.P2pNode), "Mempool Mirror"); + services.Register(() => new MempoolMirror(coreNode.RpcClient, coreNode.P2pNode, TimeSpan.FromSeconds(2)), "Mempool Mirror"); try { var rpc = coreNode.RpcClient; diff --git a/WalletWasabi.Tests/UnitTests/BitcoinCore/P2pBasedTests.cs b/WalletWasabi.Tests/UnitTests/BitcoinCore/P2pBasedTests.cs index fdaff55a14e..c3662bf241c 100644 --- a/WalletWasabi.Tests/UnitTests/BitcoinCore/P2pBasedTests.cs +++ b/WalletWasabi.Tests/UnitTests/BitcoinCore/P2pBasedTests.cs @@ -141,7 +141,7 @@ public async Task BlockNotifierTestsAsync() { var coreNode = await TestNodeBuilder.CreateAsync(); using HostedServices services = new(); - services.Register(() => new BlockNotifier(TimeSpan.FromSeconds(7), coreNode.RpcClient, coreNode.P2pNode), "Block Notifier"); + services.Register(() => new BlockNotifier(coreNode.RpcClient, coreNode.P2pNode,TimeSpan.FromSeconds(7) ), "Block Notifier"); await services.StartAllAsync(); try diff --git a/WalletWasabi.Tests/UnitTests/BlockNotifierTests.cs b/WalletWasabi.Tests/UnitTests/BlockNotifierTests.cs index 171b9f171fa..2196b3659ee 100644 --- a/WalletWasabi.Tests/UnitTests/BlockNotifierTests.cs +++ b/WalletWasabi.Tests/UnitTests/BlockNotifierTests.cs @@ -273,7 +273,7 @@ private BlockNotifier CreateNotifier(ConcurrentChain chain) rpc.OnGetBlockHeaderAsync = (blockHash) => Task.FromResult(chain.GetBlock(blockHash).Header); - var notifier = new BlockNotifier(TimeSpan.FromMilliseconds(100), rpc); + var notifier = new BlockNotifier(rpc, period: TimeSpan.FromMilliseconds(100)); return notifier; } diff --git a/WalletWasabi.Tests/UnitTests/WabiSabi/Backend/UtxoPrisonWardenTests.cs b/WalletWasabi.Tests/UnitTests/WabiSabi/Backend/UtxoPrisonWardenTests.cs index a4167d7c727..955a4ecce83 100644 --- a/WalletWasabi.Tests/UnitTests/WabiSabi/Backend/UtxoPrisonWardenTests.cs +++ b/WalletWasabi.Tests/UnitTests/WabiSabi/Backend/UtxoPrisonWardenTests.cs @@ -4,6 +4,7 @@ using WalletWasabi.Helpers; using WalletWasabi.Tests.Helpers; using WalletWasabi.WabiSabi; +using WalletWasabi.WabiSabi.Backend; using WalletWasabi.WabiSabi.Backend.DoSPrevention; using Xunit; @@ -16,10 +17,7 @@ public async Task CanStartAndStopAsync() { var workDir = Common.GetWorkDir(); await IoHelpers.TryDeleteDirectoryAsync(workDir); - CoordinatorParameters coordinatorParameters = new(workDir); - using var w = new Warden( - coordinatorParameters.PrisonFilePath, - coordinatorParameters.RuntimeCoordinatorConfig); + using var w = new Warden(new WabiSabiConfig()); await w.StartAsync(CancellationToken.None); await w.StopAsync(CancellationToken.None); } @@ -31,10 +29,7 @@ public async Task PrisonSerializationAsync() await IoHelpers.TryDeleteDirectoryAsync(workDir); // Create prison. - CoordinatorParameters coordinatorParameters = new(workDir); - using var w = new Warden( - coordinatorParameters.PrisonFilePath, - coordinatorParameters.RuntimeCoordinatorConfig); + using var w = new Warden(new WabiSabiConfig()); await w.StartAsync(CancellationToken.None); var now = DateTimeOffset.FromUnixTimeSeconds(DateTimeOffset.UtcNow.ToUnixTimeSeconds()); var i1 = BitcoinFactory.CreateOutPoint(); @@ -52,11 +47,11 @@ public async Task PrisonSerializationAsync() await w.StopAsync(CancellationToken.None); // See if prev UTXOs are loaded. - CoordinatorParameters coordinatorParameters2 = new(workDir); - using var w2 = new Warden(coordinatorParameters2.PrisonFilePath, coordinatorParameters2.RuntimeCoordinatorConfig); + var cfg = new WabiSabiConfig(); + using var w2 = new Warden(cfg); await w2.StartAsync(CancellationToken.None); - var dosConfig = coordinatorParameters2.RuntimeCoordinatorConfig.GetDoSConfiguration(); + var dosConfig = cfg.GetDoSConfiguration(); Assert.True(w2.Prison.IsBanned(i1, dosConfig, DateTimeOffset.UtcNow)); Assert.True(w2.Prison.IsBanned(i2, dosConfig, DateTimeOffset.UtcNow)); Assert.True(w2.Prison.IsBanned(i3, dosConfig, DateTimeOffset.UtcNow)); diff --git a/WalletWasabi.Tests/UnitTests/WabiSabi/Client/ArenaClientTests.cs b/WalletWasabi.Tests/UnitTests/WabiSabi/Client/ArenaClientTests.cs index bd03fb45897..d8f388b1d56 100644 --- a/WalletWasabi.Tests/UnitTests/WabiSabi/Client/ArenaClientTests.cs +++ b/WalletWasabi.Tests/UnitTests/WabiSabi/Client/ArenaClientTests.cs @@ -30,8 +30,6 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Client; public class ArenaClientTests { - public MempoolMirror DummyMempoolMirror { get; } = new(TimeSpan.Zero, null!, null!); - [Fact] public async Task FullP2wpkhCoinjoinTestAsync() { diff --git a/WalletWasabi.Tests/UnitTests/WabiSabi/Client/BobClientTests.cs b/WalletWasabi.Tests/UnitTests/WabiSabi/Client/BobClientTests.cs index 31818f923b0..12b0a876da3 100644 --- a/WalletWasabi.Tests/UnitTests/WabiSabi/Client/BobClientTests.cs +++ b/WalletWasabi.Tests/UnitTests/WabiSabi/Client/BobClientTests.cs @@ -46,7 +46,7 @@ public async Task RegisterOutputTestAsync() var idempotencyRequestCache = new IdempotencyRequestCache(memoryCache); using CoinJoinFeeRateStatStore coinJoinFeeRateStatStore = new(config, arena.Rpc); - using var mempoolMirror = new MempoolMirror(TimeSpan.Zero, null!, null!); + using var mempoolMirror = new MempoolMirror(null!, null!, TimeSpan.Zero); var wabiSabiApi = new WabiSabiController(idempotencyRequestCache, arena, coinJoinFeeRateStatStore); InsecureRandom insecureRandom = InsecureRandom.Instance; diff --git a/WalletWasabi.Tests/UnitTests/WabiSabi/Integration/WabiSabiApiApplicationFactory.cs b/WalletWasabi.Tests/UnitTests/WabiSabi/Integration/WabiSabiApiApplicationFactory.cs index c1e4fffe8f9..ff1a023a6b9 100644 --- a/WalletWasabi.Tests/UnitTests/WabiSabi/Integration/WabiSabiApiApplicationFactory.cs +++ b/WalletWasabi.Tests/UnitTests/WabiSabi/Integration/WabiSabiApiApplicationFactory.cs @@ -63,7 +63,7 @@ protected override void ConfigureWebHost(IWebHostBuilder builder) services.AddScoped(s => new CoinJoinScriptStore()); services.AddSingleton(); services.AddHttpClient(); - services.AddSingleton(s => new MempoolMirror(TimeSpan.Zero, null!, null!)); + services.AddSingleton(s => new MempoolMirror(null!, null!, TimeSpan.Zero)); }); builder.ConfigureLogging(o => o.SetMinimumLevel(LogLevel.Warning)); } diff --git a/WalletWasabi/BitcoinCore/CoreNode.cs b/WalletWasabi/BitcoinCore/CoreNode.cs index ca84f2a3292..fee9057d16d 100644 --- a/WalletWasabi/BitcoinCore/CoreNode.cs +++ b/WalletWasabi/BitcoinCore/CoreNode.cs @@ -251,7 +251,7 @@ public static async Task CreateAsync(CoreNodeParams coreNodeParams, Ca Logger.LogInfo($"Started {Constants.BuiltinBitcoinNodeName}."); } - coreNode.P2pNode = new P2pNode(coreNode.Network, coreNode.P2pEndPoint, coreNode.MempoolService, coreNodeParams.UserAgent); + coreNode.P2pNode = new P2pNode(coreNode.Network, coreNode.P2pEndPoint, coreNode.MempoolService); await coreNode.P2pNode.ConnectAsync(cancel).ConfigureAwait(false); return coreNode; diff --git a/WalletWasabi/BitcoinCore/Mempool/MempoolMirror.cs b/WalletWasabi/BitcoinCore/Mempool/MempoolMirror.cs index dd04e9c0a05..8517fb42284 100644 --- a/WalletWasabi/BitcoinCore/Mempool/MempoolMirror.cs +++ b/WalletWasabi/BitcoinCore/Mempool/MempoolMirror.cs @@ -14,7 +14,7 @@ namespace WalletWasabi.BitcoinCore.Mempool; public class MempoolMirror : PeriodicRunner { /// How often to mirror the mempool. - public MempoolMirror(TimeSpan period, IRPCClient rpc, P2pNode node) : base(period) + public MempoolMirror( IRPCClient rpc, P2pNode node, TimeSpan? period = null) : base(period ?? TimeSpan.FromSeconds(21)) { Rpc = rpc; Node = node; diff --git a/WalletWasabi/BitcoinCore/P2pNode.cs b/WalletWasabi/BitcoinCore/P2pNode.cs index a4d17794a28..daca4f8718d 100644 --- a/WalletWasabi/BitcoinCore/P2pNode.cs +++ b/WalletWasabi/BitcoinCore/P2pNode.cs @@ -16,12 +16,11 @@ public class P2pNode { private bool _disposed = false; - public P2pNode(Network network, EndPoint endPoint, MempoolService mempoolService, string userAgent) + public P2pNode(Network network, EndPoint endPoint, MempoolService mempoolService) { Network = Guard.NotNull(nameof(network), network); EndPoint = Guard.NotNull(nameof(endPoint), endPoint); MempoolService = Guard.NotNull(nameof(mempoolService), mempoolService); - UserAgent = Guard.NotNullOrEmptyOrWhitespace(nameof(userAgent), userAgent, trim: true); Stop = new CancellationTokenSource(); NodeEventsSubscribed = false; @@ -38,7 +37,6 @@ public P2pNode(Network network, EndPoint endPoint, MempoolService mempoolService private Network Network { get; } private EndPoint EndPoint { get; } public MempoolService MempoolService { get; } - private string UserAgent { get; } private bool NodeEventsSubscribed { get; set; } private object SubscriptionLock { get; } @@ -52,7 +50,6 @@ public async Task ConnectAsync(CancellationToken cancel) handshakeTimeout.CancelAfter(TimeSpan.FromSeconds(21)); var parameters = new NodeConnectionParameters() { - UserAgent = UserAgent, ConnectCancellation = linked.Token, IsRelay = true }; diff --git a/WalletWasabi/Blockchain/BlockFilters/IndexBuilderService.cs b/WalletWasabi/Blockchain/BlockFilters/IndexBuilderService.cs index 77450b6d578..b73c133f5c8 100644 --- a/WalletWasabi/Blockchain/BlockFilters/IndexBuilderService.cs +++ b/WalletWasabi/Blockchain/BlockFilters/IndexBuilderService.cs @@ -29,12 +29,14 @@ public class IndexBuilderService private long _workerCount; - public IndexBuilderService(IRPCClient rpc, BlockNotifier blockNotifier, string indexFilePath) + public IndexBuilderService(IRPCClient rpc, BlockNotifier blockNotifier) { RpcClient = Guard.NotNull(nameof(rpc), rpc); BlockNotifier = Guard.NotNull(nameof(blockNotifier), blockNotifier); - IndexFilePath = Guard.NotNullOrEmptyOrWhitespace(nameof(indexFilePath), indexFilePath); + var indexBuilderServiceDir = Path.Combine(".", "IndexBuilderService"); + var indexFilePath = Path.Combine(indexBuilderServiceDir, $"Index{rpc.Network}.dat"); + IndexFilePath = Guard.NotNullOrEmptyOrWhitespace(nameof(indexFilePath), indexFilePath); StartingHeight = SmartHeader.GetStartingHeader(RpcClient.Network).Height; _serviceStatus = NotStarted; diff --git a/WalletWasabi/Blockchain/Blocks/BlockNotifier.cs b/WalletWasabi/Blockchain/Blocks/BlockNotifier.cs index d371b8dcb5a..53741c1e89a 100644 --- a/WalletWasabi/Blockchain/Blocks/BlockNotifier.cs +++ b/WalletWasabi/Blockchain/Blocks/BlockNotifier.cs @@ -13,7 +13,7 @@ namespace WalletWasabi.Blockchain.Blocks; public class BlockNotifier : PeriodicRunner { - public BlockNotifier(TimeSpan period, IRPCClient rpcClient, P2pNode? p2pNode = null) : base(period) + public BlockNotifier(IRPCClient rpcClient, P2pNode? p2pNode = null, TimeSpan? period = null) : base(period ?? TimeSpan.FromSeconds(7)) { RpcClient = Guard.NotNull(nameof(rpcClient), rpcClient); P2pNode = p2pNode; diff --git a/WalletWasabi/WabiSabi/Backend/DoSPrevention/Warden.cs b/WalletWasabi/WabiSabi/Backend/DoSPrevention/Warden.cs index 9f2b19b6837..ce60190aac1 100644 --- a/WalletWasabi/WabiSabi/Backend/DoSPrevention/Warden.cs +++ b/WalletWasabi/WabiSabi/Backend/DoSPrevention/Warden.cs @@ -12,9 +12,9 @@ namespace WalletWasabi.WabiSabi.Backend.DoSPrevention; public class Warden : BackgroundService { - public Warden(string prisonFilePath, WabiSabiConfig config) + public Warden(WabiSabiConfig config) { - PrisonFilePath = prisonFilePath; + PrisonFilePath = "Prison.txt"; Config = config; OffendersToSaveChannel = Channel.CreateUnbounded(); diff --git a/WalletWasabi/WabiSabi/Backend/Rounds/Arena.cs b/WalletWasabi/WabiSabi/Backend/Rounds/Arena.cs index 99235a6bac4..d145ac4c0f4 100644 --- a/WalletWasabi/WabiSabi/Backend/Rounds/Arena.cs +++ b/WalletWasabi/WabiSabi/Backend/Rounds/Arena.cs @@ -24,12 +24,13 @@ namespace WalletWasabi.WabiSabi.Backend.Rounds; public partial class Arena : PeriodicRunner { public Arena( - TimeSpan period, WabiSabiConfig config, IRPCClient rpc, Prison prison, RoundParameterFactory roundParameterFactory, - CoinJoinScriptStore? coinJoinScriptStore = null ) : base(period) + CoinJoinScriptStore? coinJoinScriptStore = null, + TimeSpan? period = null + ) : base(period ?? TimeSpan.FromSeconds(2)) { Config = config; Rpc = rpc; diff --git a/WalletWasabi/WabiSabi/CoordinatorParameters.cs b/WalletWasabi/WabiSabi/CoordinatorParameters.cs index 5d254bb2c5e..9ed06a9f886 100644 --- a/WalletWasabi/WabiSabi/CoordinatorParameters.cs +++ b/WalletWasabi/WabiSabi/CoordinatorParameters.cs @@ -58,9 +58,4 @@ public CoordinatorParameters(string dataDir) /// Set how often changes in the configuration file should be monitored. /// public TimeSpan ConfigChangeMonitoringPeriod { get; init; } = TimeSpan.FromSeconds(7); - - /// - /// How often should rounds be stepped. - /// - public TimeSpan RoundProgressSteppingPeriod { get; init; } = TimeSpan.FromSeconds(1); } diff --git a/WalletWasabi/WabiSabi/WabiSabiCoordinator.cs b/WalletWasabi/WabiSabi/WabiSabiCoordinator.cs index 77cb6caab56..dee28a9c507 100644 --- a/WalletWasabi/WabiSabi/WabiSabiCoordinator.cs +++ b/WalletWasabi/WabiSabi/WabiSabiCoordinator.cs @@ -23,7 +23,7 @@ public WabiSabiCoordinator(CoordinatorParameters parameters, IRPCClient rpc, Co { Parameters = parameters; RpcClient = rpc; - Warden = new(parameters.PrisonFilePath, Config); + Warden = new(Config); ConfigWatcher = new(parameters.ConfigChangeMonitoringPeriod, Config, () => Logger.LogInfo("WabiSabi configuration has changed.")); CoinJoinFeeRateStatStore = CoinJoinFeeRateStatStore.LoadFromFile(parameters.CoinJoinFeeRateStatStoreFilePath, Config, rpc); @@ -34,7 +34,6 @@ public WabiSabiCoordinator(CoordinatorParameters parameters, IRPCClient rpc, Co RoundParameterFactory roundParameterFactory = new(Config, rpc.Network); Arena = new( - parameters.RoundProgressSteppingPeriod, Config, rpc, Warden.Prison,