Fighting with warnings
MODIFY
WalletWasabi.Gui/Models/ShieldState.cs
WalletWasabi.Gui/Models/ShieldState.cs
@@ -17,7 +17,7 @@ namespace WalletWasabi.Gui.Models
public bool IsPrivacyStrongVisible { get; }
public bool IsPrivacySaiyanVisible { get; }
- public override bool Equals(object obj)
+ public override bool Equals(object? obj)
{
if (obj is ShieldState state)
{

DELETE
WalletWasabi.Tests/UnitTests/Converters/OutPointAsTxoRefJsonConverterTests.cs
-using NBitcoin;
-using Newtonsoft.Json;
-using WalletWasabi.JsonConverters;
-using Xunit;
-
-namespace WalletWasabi.Tests.UnitTests.Converters
-{
- public class OutPointAsTxoRefJsonConverterTests
- {
- [Fact]
- public void Tests()
- {
- var outpoint = new OutPoint(new uint256("2716e680f47d74c1bc6f031da22331564dd4c6641d7216576aad1b846c85d492"), 765);
- var txoref = new TxoRef(new uint256("2716e680f47d74c1bc6f031da22331564dd4c6641d7216576aad1b846c85d492"), 765);
-
- var oldConverters = new JsonConverter[]
- {
- new Uint256JsonConverter(),
- new OutPointJsonConverter()
- };
- var newConverters = new JsonConverter[]
- {
- new Uint256JsonConverter(),
- new OutPointAsTxoRefJsonConverter()
- };
-
- // Serialization test
- var serializedTxoRef = JsonConvert.SerializeObject(txoref, oldConverters);
- var serializedOutPoint = JsonConvert.SerializeObject(outpoint, newConverters);
- Assert.Equal(serializedTxoRef, serializedOutPoint);
-
- // Deserialization test
- var deserializedTxoRef = JsonConvert.DeserializeObject<TxoRef>(serializedTxoRef, oldConverters);
- var deserializedOutPoint = JsonConvert.DeserializeObject<TxoRef>(serializedTxoRef, newConverters);
- Assert.Equal(deserializedTxoRef, deserializedOutPoint);
-
- // Deserialization compatibility test
- deserializedTxoRef = JsonConvert.DeserializeObject<TxoRef>(serializedTxoRef, newConverters);
- deserializedOutPoint = JsonConvert.DeserializeObject<TxoRef>(serializedTxoRef, oldConverters);
- Assert.Equal(deserializedTxoRef, deserializedOutPoint);
-
- // Deserialization case insensitivity test
- var deserializedOutPoint2 = JsonConvert.DeserializeObject<TxoRef>(serializedOutPoint.ToLower(), newConverters);
- Assert.Equal(deserializedOutPoint, deserializedOutPoint2);
- }
- }
-}

DELETE
WalletWasabi.Tests/UnitTests/Converters/TxoRef.cs
-using System.ComponentModel.DataAnnotations;
-using NBitcoin;
-using Newtonsoft.Json;
-using WalletWasabi.JsonConverters;
-
-namespace WalletWasabi.Tests.UnitTests.Converters
-{
- [JsonObject(MemberSerialization.OptIn)]
- public class TxoRef
- {
- [JsonConstructor]
- public TxoRef(uint256 transactionId, uint index)
- {
- TransactionId = transactionId;
- Index = index;
- }
-
- [Required]
- [JsonProperty(Order = 1)]
- [JsonConverter(typeof(Uint256JsonConverter))]
- public uint256 TransactionId { get; }
-
- [JsonProperty(Order = 2)]
- public uint Index { get; }
-
- public override bool Equals(object obj)
- {
- if (ReferenceEquals(this, obj))
- {
- return true;
- }
-
- if (this is null || !(obj is TxoRef other))
- {
- return false;
- }
- return (TransactionId, Index) == (other.TransactionId, other.Index);
- }
-
- public override int GetHashCode() => (TransactionId, Index).GetHashCode();
- }
-}

MODIFY
WalletWasabi/BitcoinCore/Monitoring/RpcStatus.cs
WalletWasabi/BitcoinCore/Monitoring/RpcStatus.cs
@@ -4,8 +4,6 @@ namespace WalletWasabi.BitcoinCore.Monitoring
{
public class RpcStatus : IEquatable<RpcStatus>
{
- public static RpcStatus Unresponsive = new RpcStatus(false, 0, 0, 0);
-
private RpcStatus(bool success, ulong headers, ulong blocks, int peersCount)
{
Synchronized = false;
@@ -37,6 +35,8 @@ namespace WalletWasabi.BitcoinCore.Monitoring
PeersCount = peersCount;
}
+ public static RpcStatus Unresponsive { get; } = new RpcStatus(false, 0, 0, 0);
+
public string Status { get; }
public bool Success { get; }
public ulong Headers { get; }

MODIFY
WalletWasabi/Blockchain/Analysis/FeesEstimation/AllFeeEstimate.cs
WalletWasabi/Blockchain/Analysis/FeesEstimation/AllFeeEstimate.cs
@@ -13,31 +13,6 @@ namespace WalletWasabi.Blockchain.Analysis.FeesEstimation
{
[JsonConstructor]
public AllFeeEstimate(EstimateSmartFeeMode type, IDictionary<int, int> estimations, bool isAccurate)
- {
- Create(type, estimations, isAccurate);
- }
-
- public AllFeeEstimate(AllFeeEstimate other, bool isAccurate)
- {
- Create(other.Type, other.Estimations, isAccurate);
- }
-
- [JsonProperty]
- public EstimateSmartFeeMode Type { get; private set; }
-
- /// <summary>
- /// Gets a value indicating whether the fee has been fetched from a fully synced node.
- /// </summary>
- [JsonProperty]
- public bool IsAccurate { get; private set; }
-
- /// <summary>
- /// Gets the fee estimations: int: fee target, int: satoshi/vByte
- /// </summary>
- [JsonProperty]
- public Dictionary<int, int> Estimations { get; private set; }
-
- private void Create(EstimateSmartFeeMode type, IDictionary<int, int> estimations, bool isAccurate)
{
Type = type;
IsAccurate = isAccurate;
@@ -57,6 +32,26 @@ namespace WalletWasabi.Blockchain.Analysis.FeesEstimation
}
}
+ public AllFeeEstimate(AllFeeEstimate other, bool isAccurate)
+ : this(other.Type, other.Estimations, isAccurate)
+ {
+ }
+
+ [JsonProperty]
+ public EstimateSmartFeeMode Type { get; }
+
+ /// <summary>
+ /// Gets a value indicating whether the fee has been fetched from a fully synced node.
+ /// </summary>
+ [JsonProperty]
+ public bool IsAccurate { get; }
+
+ /// <summary>
+ /// Gets the fee estimations: int: fee target, int: satoshi/vByte
+ /// </summary>
+ [JsonProperty]
+ public Dictionary<int, int> Estimations { get; }
+
public FeeRate GetFeeRate(int feeTarget)
{
// Where the target is still under or equal to the requested target.

MODIFY
WalletWasabi/CoinJoin/Common/Models/BlindedOutputWithNonceIndex.cs
WalletWasabi/CoinJoin/Common/Models/BlindedOutputWithNonceIndex.cs
@@ -18,23 +18,14 @@ namespace WalletWasabi.CoinJoin.Common.Models
[JsonConverter(typeof(Uint256JsonConverter))]
public uint256 BlindedOutput { get; set; }
- public override bool Equals(object obj)
- {
- if (obj is BlindedOutputWithNonceIndex other)
- {
- return Equals(other);
- }
- return false;
- }
+ public override bool Equals(object? obj) => Equals(obj as BlindedOutputWithNonceIndex);
- public bool Equals(BlindedOutputWithNonceIndex other)
- {
- return other?.BlindedOutput == BlindedOutput;
- }
+ public bool Equals(BlindedOutputWithNonceIndex? other) => this == other;
- public override int GetHashCode()
- {
- return HashCode.Combine(BlindedOutput, N);
- }
+ public override int GetHashCode() => (BlindedOutput, N).GetHashCode();
+
+ public static bool operator ==(BlindedOutputWithNonceIndex? x, BlindedOutputWithNonceIndex? y) => (x?.BlindedOutput, x?.N) == (y?.BlindedOutput, y?.N);
+
+ public static bool operator !=(BlindedOutputWithNonceIndex? x, BlindedOutputWithNonceIndex? y) => !(x == y);
}
}

Fighting with warnings