Better estimation on outputs
MODIFY
WalletWasabi.Backend/Controllers/ChaumianCoinJoinController.cs
WalletWasabi.Backend/Controllers/ChaumianCoinJoinController.cs
@@ -233,9 +233,17 @@ namespace WalletWasabi.Backend.Controllers
var currentAlices = round.GetAlicesBy(AliceState.InputsRegistered).ToArray();
var coinsToTest = currentAlices.SelectMany(alice => alice.Inputs).ToList();
+
+ // Add the outputs by denomination level.
+ var outputCount = currentAlices.Sum(alice => round.EstimateBestMixingLevel(alice));
+ // Add the change outputs.
+ outputCount += currentAlices.Length;
+
+ // Add the current input registration and outputs.
coinsToTest.Add(new Coin(inputProof.Input, getTxOutResponse.TxOut));
+ outputCount += 2;
- var result = await RpcClient.TestMempoolAcceptAsync(coinsToTest, fakeOutputsCount: (currentAlices.Length + 1) * 2);
+ var result = await RpcClient.TestMempoolAcceptAsync(coinsToTest, fakeOutputsCount: outputCount);
if (!result.accept)
{
return BadRequest($"Provided input is from an unconfirmed coinjoin, but a limit is reached: {result.rejectReason}");

MODIFY
WalletWasabi/CoinJoin/Coordinator/Rounds/CoordinatorRound.cs
WalletWasabi/CoinJoin/Coordinator/Rounds/CoordinatorRound.cs
@@ -1179,7 +1179,12 @@ namespace WalletWasabi.CoinJoin.Coordinator.Rounds
// Check if mempool would accept a fake transaction created with the all the registered inputs.
var coinsToTest = Alices.SelectMany(alice => alice.Inputs);
- var resultAll = await RpcClient.TestMempoolAcceptAsync(coinsToTest, fakeOutputsCount: (Alices.Count + 1) * 2);
+ // Add the outputs by denomination level.
+ var outputsAll = Alices.Sum(alice => EstimateBestMixingLevel(alice));
+ // Add the change outputs.
+ outputsAll += Alices.Count;
+
+ var resultAll = await RpcClient.TestMempoolAcceptAsync(coinsToTest, fakeOutputsCount: outputsAll);
if (resultAll.accept)
{
Logger.LogInfo($"Mempool acceptance successful! Number of Alices: {Alices.Count}.");
@@ -1192,7 +1197,8 @@ namespace WalletWasabi.CoinJoin.Coordinator.Rounds
{
// Check if mempool would accept a fake transaction created with the registered input.
// This will catch ascendant/descendant count and size limits for example.
- checkingTasks.Add((alice, batch.TestMempoolAcceptAsync(alice.Inputs, fakeOutputsCount: 2)));
+ var outputs = EstimateBestMixingLevel(alice) + 1;
+ checkingTasks.Add((alice, batch.TestMempoolAcceptAsync(alice.Inputs, fakeOutputsCount: outputs)));
}
var waiting = Task.WhenAll(checkingTasks.Select(t => t.task));
await batch.SendBatchAsync().ConfigureAwait(false);

Better estimation on outputs