Add ICoinsView::CreatedBy method
MODIFY
WalletWasabi/Models/CoinsRegistry.cs
WalletWasabi/Models/CoinsRegistry.cs
using System;
using System.Collections;
using System.Collections.Generic;
-using System.Collections.Specialized;
using System.Linq;
using NBitcoin;
@@ -14,8 +13,6 @@ namespace WalletWasabi.Models
private bool InvalidateSnapshot { get; set; }
private object Lock { get; set; }
- public event NotifyCollectionChangedEventHandler CollectionChanged;
-
public CoinsRegistry()
{
Coins = new HashSet<SmartCoin>();
@@ -52,11 +49,6 @@ namespace WalletWasabi.Models
added = Coins.Add(coin);
InvalidateSnapshot |= added;
}
-
- if (added)
- {
- CollectionChanged?.Invoke(this, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, coin));
- }
return added;
}
@@ -76,7 +68,6 @@ namespace WalletWasabi.Models
}
InvalidateSnapshot = true;
}
- CollectionChanged?.Invoke(this, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Remove, removedCoins));
}
public void Clear()
@@ -86,7 +77,6 @@ namespace WalletWasabi.Models
Coins.Clear();
InvalidateSnapshot = true;
}
- CollectionChanged?.Invoke(this, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset));
}
public ICoinsView AtBlockHeight(Height height)
@@ -134,6 +124,11 @@ namespace WalletWasabi.Models
return AsCoinsView().OutPoints(outPoints);
}
+ public ICoinsView CreatedBy(uint256 txid)
+ {
+ return AsCoinsView().CreatedBy(txid);
+ }
+
public ICoinsView SpentBy(uint256 txid)
{
return AsCoinsView().SpentBy(txid);

MODIFY
WalletWasabi/Models/CoinsView.cs
WalletWasabi/Models/CoinsView.cs
@@ -47,6 +47,11 @@ namespace WalletWasabi.Models
return new CoinsView(Coins.Where(x => x.Height == height));
}
+ public ICoinsView CreatedBy(uint256 txid)
+ {
+ return new CoinsView(Coins.Where(x => x.TransactionId == txid));
+ }
+
public ICoinsView SpentBy(uint256 txid)
{
return new CoinsView(Coins.Where(x => x.SpenderTransactionId == txid));

MODIFY
WalletWasabi/Models/ICoinsView.cs
WalletWasabi/Models/ICoinsView.cs
@@ -14,6 +14,7 @@ namespace WalletWasabi.Models
ICoinsView DescendantOf(SmartCoin coin);
ICoinsView FilterBy(Func<SmartCoin, bool> expression);
ICoinsView OutPoints(IEnumerable<TxoRef> outPoints);
+ ICoinsView CreatedBy(uint256 txid);
ICoinsView SpentBy(uint256 txid);
SmartCoin[] ToArray();
Money TotalAmount();

Add ICoinsView::CreatedBy method