Raise new event if references are not equal
Hopefully raises the event if the new spenderTransaction of the SmartCoin is equal to the last one, but it's a duplicate of the last one (has different pointer).
MODIFY
WalletWasabi/Bases/NotifyPropertyChangedBase.cs
WalletWasabi/Bases/NotifyPropertyChangedBase.cs
@@ -27,6 +27,18 @@ namespace WalletWasabi.Bases
return true;
}
+ protected bool RaiseAndSetIfRefChanged<T>(ref T field, ref T value, [CallerMemberName] string propertyName = null)
+ {
+ if (ReferenceEquals(field, value))
+ {
+ return false;
+ }
+
+ field = value;
+ OnPropertyChanged(propertyName);
+ return true;
+ }
+
#endregion Events
}
}

MODIFY
WalletWasabi/Blockchain/TransactionOutputs/SmartCoin.cs
WalletWasabi/Blockchain/TransactionOutputs/SmartCoin.cs
@@ -78,10 +78,8 @@ namespace WalletWasabi.Blockchain.TransactionOutputs
get => _spenderTransaction;
set
{
- if (!Object.ReferenceEquals(value, _spenderTransaction))
+ if (RaiseAndSetIfRefChanged(ref _spenderTransaction, ref value))
{
- _spenderTransaction = value;
- OnPropertyChanged(nameof(SpenderTransaction));
value?.WalletInputs.Add(this);
}
}

Raise new event if references are not equal

Hopefully raises the event if the new spenderTransaction of the SmartCoin is equal to the last one, but it's a duplicate of the last one (has different pointer).