`WabiSabiHttpApiIntegrationTests`: Remove unused `GetStatefullMockRpc`
MODIFY
WalletWasabi.Tests/UnitTests/WabiSabi/Integration/WabiSabiHttpApiIntegrationTests.cs
WalletWasabi.Tests/UnitTests/WabiSabi/Integration/WabiSabiHttpApiIntegrationTests.cs
@@ -195,8 +195,8 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Integration
return tx.GetHash();
};
- // Instruct the coodinator DI container to use these two scoped
- // services to build everything (wabisabi controller, arena, etc)
+ // Instruct the coordinator DI container to use these two scoped
+ // services to build everything (WabiSabi controller, arena, etc)
services.AddScoped<IRPCClient>(s => rpc);
services.AddScoped<WabiSabiConfig>(s => new WabiSabiConfig {
MaxInputCountByRound = 2 * inputCount,
@@ -257,7 +257,7 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Integration
builder.ConfigureServices(services =>
{
// Instruct the coordinator DI container to use these two scoped
- // services to build everything (wabisabi controller, arena, etc)
+ // services to build everything (WabiSabi controller, arena, etc)
services.AddScoped<IRPCClient>(s => rpc);
services.AddScoped<WabiSabiConfig>(s => new WabiSabiConfig
{
@@ -383,74 +383,6 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Integration
Assert.NotEqual(uint256.Zero, response.Value);
}
- private IRPCClient GetStatefullMockRpc()
- {
- var rpc = BitcoinFactory.GetMockMinimalRpc();
-
- var blocks = new List<Block>();
- var mempool = new List<Transaction>();
-
- // Declarations
- var confirmedTransactions = blocks.SelectMany(b => b.Transactions);
- var transactions = confirmedTransactions.Concat(mempool);
- var coins = transactions.SelectMany(t => t.Outputs.Select(o => new Coin(t, o)));
- var spentCoins = transactions.SelectMany(t => t.Inputs.Where(i => i.PrevOut.Hash != uint256.Zero).Select(i => coins.Single(c => c.Outpoint == i.PrevOut)));
- var unspentCoins = coins.Except(spentCoins);
-
- // Make the coordinator to believe that those two coins are real and
- // that they exist in the blockchain with many confirmations.
- rpc.OnGetTxOutAsync = (txId, idx, _) =>
- {
- var coin = unspentCoins.FirstOrDefault(c => (c.Outpoint.Hash, c.Outpoint.N) == (txId, idx));
- if (coin is null)
- {
- return null;
- }
- return new()
- {
- Confirmations = 101,
- IsCoinBase = false,
- ScriptPubKeyType = "witness_v0_keyhash",
- TxOut = coin.TxOut
- };
- };
-
- rpc.OnGetBlockAsync = (blockId) =>
- Task.FromResult(blocks.First(b => b.GetHash() == blockId));
-
- // Make the coordinator believe that the transaction is being
- // broadcasted using the RPC interface. Once we receive this tx
- // (the `SendRawTransationAsync` was invoked) we stop waiting
- // and finish the waiting tasks to finish the test successfully.
- rpc.OnSendRawTransactionAsync = (tx) =>
- {
- mempool.Add(tx);
- return tx.GetHash();
- };
-
- rpc.OnGenerateToAddressAsync = (n, address) =>
- {
- var block = Block
- .CreateBlock(Network.Main)
- .CreateNextBlockWithCoinbase(address, blocks.Count);
-
- blocks.Add(block);
- return Task.FromResult(new[] { block.GetHash() });
- };
-
- rpc.OnGetRawMempoolAsync = () =>
- {
- return Task.FromResult(mempool.Select(x => x.GetHash()).ToArray());
- };
-
- rpc.OnGetRawTransactionAsync = (txid, includeMempool) =>
- {
- return Task.FromResult(transactions.First(x => x.GetHash() == txid));
- };
-
- return rpc;
- }
-
private class StuttererHttpClient : HttpClientWrapper
{
public StuttererHttpClient(HttpClient httpClient) : base(httpClient)

`WabiSabiHttpApiIntegrationTests`: Remove unused `GetStatefullMockRpc`