Skip to content

Commit

Permalink
Merge branch 'master' into SendManualControl2
Browse files Browse the repository at this point in the history
  • Loading branch information
ichthus1604 committed May 6, 2024
2 parents 42a0523 + eda718b commit 2f9e810
Show file tree
Hide file tree
Showing 113 changed files with 689 additions and 2,703 deletions.
3 changes: 0 additions & 3 deletions WalletWasabi.Backend/Controllers/BlockchainController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,11 @@
using WalletWasabi.BitcoinCore.Mempool;
using WalletWasabi.BitcoinCore.Rpc;
using WalletWasabi.Blockchain.Analysis.FeesEstimation;
using WalletWasabi.Blockchain.BlockFilters;
using WalletWasabi.Cache;
using WalletWasabi.Extensions;
using WalletWasabi.Helpers;
using WalletWasabi.Logging;
using WalletWasabi.Models;
using WalletWasabi.WabiSabi.Backend.Statistics;

namespace WalletWasabi.Backend.Controllers;

Expand Down Expand Up @@ -434,7 +432,6 @@ public async Task<IActionResult> GetUnconfirmedTransactionChainAsync([FromQuery,
action: (string request, CancellationToken token) => GetUnconfirmedTransactionChainNoCacheAsync(txId, token),
options: UnconfirmedTransactionChainCacheEntryOptions,
cancellationToken);
RequestTimeStatista.Instance.Add("unconfirmed-transaction-chain", DateTimeOffset.UtcNow - before);
return ret;
}
catch (OperationCanceledException)
Expand Down
44 changes: 4 additions & 40 deletions WalletWasabi.Backend/Controllers/WabiSabiController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,10 @@ public WabiSabiController(IdempotencyRequestCache idempotencyRequestCache, Arena
[HttpPost("status")]
public async Task<RoundStateResponse> GetStatusAsync(RoundStateRequest request, CancellationToken cancellationToken)
{
var before = DateTimeOffset.UtcNow;
var response = await Arena.GetStatusAsync(request, cancellationToken);
var medians = CoinJoinFeeRateStatStore.GetDefaultMedians();
var affiliateInformation = AffiliationManager.GetAffiliateInformation();
var ret = new RoundStateResponse(response.RoundStates, medians, affiliateInformation);

var duration = DateTimeOffset.UtcNow - before;
RequestTimeStatista.Instance.Add("status", duration);
return ret;
return new RoundStateResponse(response.RoundStates, medians, affiliateInformation);
}

[HttpPost("connection-confirmation")]
Expand All @@ -58,12 +53,7 @@ public async Task<ConnectionConfirmationResponse> ConfirmConnectionAsync(Connect
using CancellationTokenSource timeoutCts = new(RequestTimeout);
using CancellationTokenSource linkedCts = CancellationTokenSource.CreateLinkedTokenSource(timeoutCts.Token, cancellationToken);

var before = DateTimeOffset.UtcNow;
var ret = await IdempotencyRequestCache.GetCachedResponseAsync(request, action: Arena.ConfirmConnectionAsync, linkedCts.Token);

var duration = DateTimeOffset.UtcNow - before;
RequestTimeStatista.Instance.Add("connection-confirmation", duration);
return ret;
return await IdempotencyRequestCache.GetCachedResponseAsync(request, action: Arena.ConfirmConnectionAsync, linkedCts.Token);
}

[HttpPost("input-registration")]
Expand All @@ -72,12 +62,7 @@ public async Task<InputRegistrationResponse> RegisterInputAsync(InputRegistratio
using CancellationTokenSource timeoutCts = new(RequestTimeout);
using CancellationTokenSource linkedCts = CancellationTokenSource.CreateLinkedTokenSource(timeoutCts.Token, cancellationToken);

var before = DateTimeOffset.UtcNow;
InputRegistrationResponse ret = await IdempotencyRequestCache.GetCachedResponseAsync(request, Arena.RegisterInputAsync, linkedCts.Token);

var duration = DateTimeOffset.UtcNow - before;
RequestTimeStatista.Instance.Add("input-registration", duration);
return ret;
return await IdempotencyRequestCache.GetCachedResponseAsync(request, Arena.RegisterInputAsync, linkedCts.Token);
}

[HttpPost("output-registration")]
Expand All @@ -86,11 +71,7 @@ public async Task RegisterOutputAsync(OutputRegistrationRequest request, Cancell
using CancellationTokenSource timeoutCts = new(RequestTimeout);
using CancellationTokenSource linkedCts = CancellationTokenSource.CreateLinkedTokenSource(timeoutCts.Token, cancellationToken);

var before = DateTimeOffset.UtcNow;
await IdempotencyRequestCache.GetCachedResponseAsync(request, action: Arena.RegisterOutputCoreAsync, linkedCts.Token);

var duration = DateTimeOffset.UtcNow - before;
RequestTimeStatista.Instance.Add("output-registration", duration);
}

[HttpPost("credential-issuance")]
Expand All @@ -99,42 +80,25 @@ public async Task<ReissueCredentialResponse> ReissuanceAsync(ReissueCredentialRe
using CancellationTokenSource timeoutCts = new(RequestTimeout);
using CancellationTokenSource linkedCts = CancellationTokenSource.CreateLinkedTokenSource(timeoutCts.Token, cancellationToken);

var before = DateTimeOffset.UtcNow;
var ret = await IdempotencyRequestCache.GetCachedResponseAsync(request, action: Arena.ReissuanceAsync, linkedCts.Token);

var duration = DateTimeOffset.UtcNow - before;
RequestTimeStatista.Instance.Add("credential-issuance", duration);
return ret;
return await IdempotencyRequestCache.GetCachedResponseAsync(request, action: Arena.ReissuanceAsync, linkedCts.Token);
}

[HttpPost("input-unregistration")]
public async Task RemoveInputAsync(InputsRemovalRequest request, CancellationToken cancellableToken)
{
var before = DateTimeOffset.UtcNow;
await Arena.RemoveInputAsync(request, cancellableToken);

var duration = DateTimeOffset.UtcNow - before;
RequestTimeStatista.Instance.Add("input-unregistration", duration);
}

[HttpPost("transaction-signature")]
public async Task SignTransactionAsync(TransactionSignaturesRequest request, CancellationToken cancellableToken)
{
var before = DateTimeOffset.UtcNow;
await Arena.SignTransactionAsync(request, cancellableToken);

var duration = DateTimeOffset.UtcNow - before;
RequestTimeStatista.Instance.Add("transaction-signature", duration);
}

[HttpPost("ready-to-sign")]
public async Task ReadyToSignAsync(ReadyToSignRequestRequest request, CancellationToken cancellableToken)
{
var before = DateTimeOffset.UtcNow;
await Arena.ReadyToSignAsync(request, cancellableToken);

var duration = DateTimeOffset.UtcNow - before;
RequestTimeStatista.Instance.Add("ready-to-sign", duration);
}

/// <summary>
Expand Down
5 changes: 1 addition & 4 deletions WalletWasabi.Backend/Global.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,10 @@ public Global(string dataDir, IRPCClient rpcClient, Config config, IHttpClientFa
P2pNode = new(config.Network, config.GetBitcoinP2pEndPoint(), new(), $"/WasabiCoordinator:{Constants.BackendMajorVersion}/");
HostedServices.Register<BlockNotifier>(() => new BlockNotifier(TimeSpan.FromSeconds(7), rpcClient, P2pNode), "Block Notifier");

EventBus = new EventBus();

// Initialize index building
var indexBuilderServiceDir = Path.Combine(DataDir, "IndexBuilderService");
var indexFilePath = Path.Combine(indexBuilderServiceDir, $"Index{RpcClient.Network}.dat");
IndexBuilderService = new(IndexType.SegwitTaproot, RpcClient, HostedServices.Get<BlockNotifier>(), indexFilePath, EventBus);
IndexBuilderService = new(IndexType.SegwitTaproot, RpcClient, HostedServices.Get<BlockNotifier>(), indexFilePath);

MempoolMirror = new MempoolMirror(TimeSpan.FromSeconds(21), RpcClient, P2pNode);
CoinJoinMempoolManager = new CoinJoinMempoolManager(CoinJoinIdStore, MempoolMirror);
Expand Down Expand Up @@ -77,7 +75,6 @@ public Global(string dataDir, IRPCClient rpcClient, Config config, IHttpClientFa
private Whitelist? WhiteList { get; set; }
public MempoolMirror MempoolMirror { get; }
public CoinJoinMempoolManager CoinJoinMempoolManager { get; private set; }
public EventBus EventBus { get; private set; }

public async Task InitializeAsync(CancellationToken cancel)
{
Expand Down
30 changes: 0 additions & 30 deletions WalletWasabi.Backend/Middlewares/Extensions.cs

This file was deleted.

Loading

0 comments on commit 2f9e810

Please sign in to comment.