Fix output sum problem
MODIFY
WalletWasabi.Backend/Controllers/ChaumianCoinJoinController.cs
WalletWasabi.Backend/Controllers/ChaumianCoinJoinController.cs
@@ -235,7 +235,7 @@ namespace WalletWasabi.Backend.Controllers
var coinsToTest = currentAlices.SelectMany(alice => alice.Inputs).ToList();
coinsToTest.Add(new Coin(inputProof.Input, getTxOutResponse.TxOut));
- var result = await RpcClient.TestMempoolAcceptAsync(coinsToTest, fakeOutputsCount: currentAlices.Length * 2);
+ var result = await RpcClient.TestMempoolAcceptAsync(coinsToTest, fakeOutputsCount: (currentAlices.Length + 1) * 2);
if (!result.accept)
{
return BadRequest($"Provided input is from an unconfirmed coinjoin, but a limit is reached: {result.rejectReason}");

MODIFY
WalletWasabi/Extensions/RPCClientExtensions.cs
WalletWasabi/Extensions/RPCClientExtensions.cs
@@ -220,9 +220,10 @@ namespace NBitcoin.RPC
// This will catch ascendant/descendant count and size limits for example.
var fakeTransaction = rpc.Network.CreateTransaction();
fakeTransaction.Inputs.AddRange(coins.Select(coin => new TxIn(coin.Outpoint)));
- Money fakeOutputValue = NBitcoinHelpers.TakeAReasonableFee(coins.Sum(coin => coin.TxOut.Value));
+ Money totalFakeOutputValue = NBitcoinHelpers.TakeAReasonableFee(coins.Sum(coin => coin.TxOut.Value));
for (int i = 0; i < fakeOutputsCount; i++)
{
+ var fakeOutputValue = totalFakeOutputValue / fakeOutputsCount;
fakeTransaction.Outputs.Add(fakeOutputValue, new Key());
}
MempoolAcceptResult testMempoolAcceptResult = await rpc.TestMempoolAcceptAsync(fakeTransaction, allowHighFees: true);

Fix output sum problem