Adding 1 hop doesn't pay
MODIFY
WalletWasabi.Tests/UnitTests/WabiSabi/Integration/WabiSabiHttpApiIntegrationTests.cs
WalletWasabi.Tests/UnitTests/WabiSabi/Integration/WabiSabiHttpApiIntegrationTests.cs
@@ -104,6 +104,18 @@ public class WabiSabiHttpApiIntegrationTests : IClassFixture<WabiSabiApiApplicat
return tx.GetHash();
};
+ rpc.OnGetRawTransactionAsync = (txid, throwIfNotFound) =>
+ {
+ var tx = coins.First(coin => coin.TransactionId == txid)?.Transaction?.Transaction;
+
+ if (tx is null)
+ {
+ return Task.FromException<Transaction>(new InvalidOperationException("tx not found"));
+ }
+
+ return Task.FromResult(tx);
+ };
+
// Instruct the coordinator DI container to use these two scoped
// services to build everything (WabiSabi controller, arena, etc)
services.AddScoped<IRPCClient>(s => rpc);
@@ -112,6 +124,7 @@ public class WabiSabiHttpApiIntegrationTests : IClassFixture<WabiSabiApiApplicat
MaxInputCountByRound = inputCount,
StandardInputRegistrationTimeout = TimeSpan.FromSeconds(10)
}
+
);
// Emulate that the first coin is coming from a CoinJoin.
services.AddScoped(s => new InMemoryCoinJoinIdStore(new[] { coins.First().Coin.Outpoint.Hash }));

MODIFY
WalletWasabi/WabiSabi/Backend/Rounds/Arena.Partial.cs
WalletWasabi/WabiSabi/Backend/Rounds/Arena.Partial.cs
@@ -60,6 +60,25 @@ public partial class Arena : IWabiSabiApiRequestHandler
var id = new Guid(Random.GetBytes(16));
var isPayingZeroCoordinationFee = InMemoryCoinJoinIdStore.Contains(coin.Outpoint.Hash);
+
+ if (!isPayingZeroCoordinationFee)
+ {
+ // If the coin comes from a tx that all of the tx inputs are coming from a CJ (1 hop - no pay).
+ Transaction? tx = null;
+ try
+ {
+ tx = await Rpc.GetRawTransactionAsync(coin.Outpoint.Hash, true, cancellationToken).ConfigureAwait(false);
+ if (tx is { } && tx.Inputs.All(input => InMemoryCoinJoinIdStore.Contains(input.PrevOut.Hash)))
+ {
+ isPayingZeroCoordinationFee = true;
+ }
+ }
+ catch (Exception)
+ {
+ round.LogWarning($"Transaction {coin.Outpoint.Hash} was not found through RPC.");
+ }
+ }
+
var alice = new Alice(coin, request.OwnershipProof, round, id, isPayingZeroCoordinationFee);
if (alice.TotalInputAmount < round.MinAmountCredentialValue)

Adding 1 hop doesn't pay