Skip to content

Commit 3dd72ac

Browse files
committed
Clean nested blocks fix abstract constructors remove shadowing
1 parent 4c90d70 commit 3dd72ac

16 files changed

Lines changed: 310 additions & 198 deletions

Monero.IntegrationTests/TestMoneroConnectionManager.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,10 @@ public void TestConnectionManager()
305305
{
306306
TestUtils.StopWalletRpcProcess(wallet);
307307
}
308-
catch { }
308+
catch
309+
{
310+
// ignore
311+
}
309312
}
310313
}
311314
}

Monero.IntegrationTests/TestMoneroDaemonRpc.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1244,7 +1244,10 @@ public void TestGetMiningStatus()
12441244
{
12451245
// stop mining at end of test
12461246
try { daemon.StopMining(); }
1247-
catch (MoneroError e) { }
1247+
catch (MoneroError e)
1248+
{
1249+
// ignore
1250+
}
12481251
}
12491252
}
12501253

Monero.IntegrationTests/TestMoneroWalletCommon.cs

Lines changed: 116 additions & 116 deletions
Large diffs are not rendered by default.

Monero.IntegrationTests/TestMoneroWalletLight.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ namespace Monero.IntegrationTests;
55

66
public class TestMoneroWalletLight : TestMoneroWalletCommon
77
{
8-
protected override void CloseWallet(MoneroWallet wallet, bool save)
8+
protected override void CloseWallet(MoneroWallet walletInstance, bool save)
99
{
1010
throw new NotImplementedException();
1111
}

Monero.IntegrationTests/TestMoneroWalletRpc.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ namespace Monero.IntegrationTests;
77

88
public class TestMoneroWalletRpc : TestMoneroWalletCommon
99
{
10-
protected override void CloseWallet(MoneroWallet wallet, bool save)
10+
protected override void CloseWallet(MoneroWallet walletInstance, bool save)
1111
{
1212
throw new NotImplementedException();
1313
}
@@ -45,25 +45,25 @@ protected override MoneroWallet OpenWallet(MoneroWalletConfig config)
4545
config.SetServer(daemon.GetRpcConnection());
4646
}
4747

48-
// create client connected to internal monero-wallet-rpc process
48+
// create a client connected to an internal monero-wallet-rpc process
4949
bool offline = TestUtils.OFFLINE_SERVER_URI.Equals(config.GetServerUri());
50-
MoneroWalletRpc wallet = TestUtils.StartWalletRpcProcess(offline);
50+
MoneroWalletRpc moneroWalletRpc = TestUtils.StartWalletRpcProcess(offline);
5151

5252
// open wallet
5353
try
5454
{
55-
wallet.OpenWallet(config);
56-
wallet.SetDaemonConnection(wallet.GetDaemonConnection(), true, null); // set daemon as trusted
57-
if (wallet.IsConnectedToDaemon())
55+
moneroWalletRpc.OpenWallet(config);
56+
moneroWalletRpc.SetDaemonConnection(moneroWalletRpc.GetDaemonConnection(), true, null); // set daemon as trusted
57+
if (moneroWalletRpc.IsConnectedToDaemon())
5858
{
59-
wallet.StartSyncing((ulong)TestUtils.SYNC_PERIOD_IN_MS);
59+
moneroWalletRpc.StartSyncing((ulong)TestUtils.SYNC_PERIOD_IN_MS);
6060
}
6161

62-
return wallet;
62+
return moneroWalletRpc;
6363
}
6464
catch (MoneroError e)
6565
{
66-
try { TestUtils.StopWalletRpcProcess(wallet); }
66+
try { TestUtils.StopWalletRpcProcess(moneroWalletRpc); }
6767
catch (Exception e2) { throw new Exception(e2.Message); }
6868

6969
throw;

Monero.IntegrationTests/Utils/WalletTxTracker.cs

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,15 @@ public void Reset()
1717

1818
public void WaitForWalletTxsToClearPool(MoneroWallet wallet)
1919
{
20-
WaitForWalletTxsToClearPool([wallet]);
21-
}
22-
23-
public void WaitForWalletTxsToClearPool(List<MoneroWallet> wallets)
24-
{
20+
List<MoneroWallet> wallets = [wallet];
2521
// get wallet tx hashes
2622
List<string> txHashesWallet = [];
27-
foreach (MoneroWallet wallet in wallets)
23+
foreach (MoneroWallet moneroWallet in wallets)
2824
{
29-
if (!clearedWallets.Contains(wallet))
25+
if (!clearedWallets.Contains(moneroWallet))
3026
{
31-
wallet.Sync();
32-
foreach (MoneroTxWallet tx in wallet.GetTxs())
27+
moneroWallet.Sync();
28+
foreach (MoneroTxWallet tx in moneroWallet.GetTxs())
3329
{
3430
string? txHash = tx.GetHash();
3531
if (txHash == null)
@@ -42,7 +38,7 @@ public void WaitForWalletTxsToClearPool(List<MoneroWallet> wallets)
4238
}
4339
}
4440

45-
// loop until all wallet txs clear from pool
41+
// loop until all wallet txs clear from the pool
4642
bool isFirst = true;
4743
bool miningStarted = false;
4844
MoneroDaemon daemon = TestUtils.GetDaemonRpc();
@@ -76,7 +72,7 @@ public void WaitForWalletTxsToClearPool(List<MoneroWallet> wallets)
7672
break;
7773
}
7874

79-
// if first time waiting, log message and start mining
75+
// if first time waiting, log a message and start mining
8076
if (isFirst)
8177
{
8278
isFirst = false;
@@ -90,7 +86,10 @@ public void WaitForWalletTxsToClearPool(List<MoneroWallet> wallets)
9086
StartMining.Start();
9187
miningStarted = true;
9288
}
93-
catch (Exception e) { } // no problem
89+
catch (Exception e)
90+
{
91+
// no problem
92+
}
9493
}
9594
}
9695

@@ -106,10 +105,10 @@ public void WaitForWalletTxsToClearPool(List<MoneroWallet> wallets)
106105
}
107106

108107
// sync wallets with the pool
109-
foreach (MoneroWallet wallet in wallets)
108+
foreach (MoneroWallet moneroWallet in wallets)
110109
{
111-
wallet.Sync();
112-
clearedWallets.Add(wallet);
110+
moneroWallet.Sync();
111+
clearedWallets.Add(moneroWallet);
113112
}
114113
}
115114
}

Monero/Common/GenUtils.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace Monero.Common;
44

5-
public class GenUtils
5+
public static class GenUtils
66
{
77
public static T? Reconcile<T>(T? val1, T? val2, bool? resolveDefined = null, bool? resolveTrue = null,
88
bool? resolveMax = null)

Monero/Common/MoneroConnection.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ public abstract class MoneroConnection
1111
protected ulong _timeoutMs;
1212
protected string? _uri;
1313

14-
public MoneroConnection(string? uri = null, string? proxyUri = null, int priority = 0, ulong timeoutMs = 2000)
14+
protected MoneroConnection(string? uri = null, string? proxyUri = null, int priority = 0, ulong timeoutMs = 2000)
1515
{
1616
_uri = uri;
1717
_proxyUri = proxyUri;
1818
_priority = priority;
1919
_timeoutMs = timeoutMs;
2020
}
2121

22-
public MoneroConnection(MoneroConnection other)
22+
protected MoneroConnection(MoneroConnection other)
2323
{
2424
_uri = other._uri;
2525
_proxyUri = other._proxyUri;

Monero/Common/MoneroConnectionManager.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,6 @@ public MoneroConnectionManager StartPolling(ulong? periodMs = null, bool? autoSw
289289
case PollType.All:
290290
StartPollingConnections((ulong)periodMs);
291291
break;
292-
case PollType.Prioritized:
293292
default:
294293
StartPollingPrioritizedConnections((ulong)periodMs, excludedConnections);
295294
break;

Monero/Common/MoneroNetwork.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public abstract class MoneroNetwork
1111

1212
public readonly MoneroNetworkType Type;
1313

14-
public MoneroNetwork(int primaryAddressCode, int integratedAddressCode, int subaddressCode, MoneroNetworkType type)
14+
protected MoneroNetwork(int primaryAddressCode, int integratedAddressCode, int subaddressCode, MoneroNetworkType type)
1515
{
1616
this._primaryAddressCode = primaryAddressCode;
1717
this._integratedAddressCode = integratedAddressCode;

0 commit comments

Comments
 (0)