Do not send one by one, but try all at once
MODIFY
WalletWasabi.Tests/UnitTests/BitcoinCore/P2pBasedTests.cs
WalletWasabi.Tests/UnitTests/BitcoinCore/P2pBasedTests.cs
@@ -7,6 +7,7 @@ using WalletWasabi.BitcoinCore;
using WalletWasabi.Blockchain.Blocks;
using WalletWasabi.Blockchain.Mempool;
using WalletWasabi.Blockchain.Transactions;
+using WalletWasabi.Helpers;
using WalletWasabi.Services;
using WalletWasabi.Stores;
using WalletWasabi.Tests.Helpers;
@@ -59,21 +60,24 @@ public class P2pBasedTests
unsubscribe: h => mempoolService.TransactionReceived -= h,
count: TransactionsCount);
- List<uint256> txHashesList = new();
+ Task<uint256>[] txHashesTasks = new Task<uint256>[TransactionsCount];
// Add to the batch 10 RPC commands: Send 1 coin to the same address.
for (int i = 0; i < TransactionsCount; i++)
{
- txHashesList.Add(await rpc.SendToAddressAsync(address, Money.Coins(1)));
+ Task<uint256> txidTask = rpc.SendToAddressAsync(address, Money.Coins(1));
+ txHashesTasks[i] = txidTask;
}
+ uint256[] txHashes = await Task.WhenAll(txHashesTasks);
+
// Wait until the mempool service receives all the sent transactions.
IEnumerable<SmartTransaction> mempoolSmartTxs = await eventAwaiter.WaitAsync(TimeSpan.FromMinutes(4));
// Check that all the received transaction hashes are in the set of sent transaction hashes.
foreach (SmartTransaction tx in mempoolSmartTxs)
{
- Assert.Contains(tx.GetHash(), txHashesList);
+ Assert.Contains(tx.GetHash(), txHashes);
}
}
finally

Do not send one by one, but try all at once