Skip to content

Commit

Permalink
Shortcut default coin selector when target = 0
Browse files Browse the repository at this point in the history
  • Loading branch information
dthorpe committed Nov 18, 2014
1 parent d667ca3 commit 74632e6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion NBitcoin/TransactionBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,14 @@ public IEnumerable<ICoin> Select(IEnumerable<ICoin> coins, Money target)
if(targetCoin != null)
return new[] { targetCoin };

var orderedCoins = coins.OrderBy(s => s.Amount).ToArray();
List<ICoin> result = new List<ICoin>();
Money total = Money.Zero;

if (target == Money.Zero)
return result;

var orderedCoins = coins.OrderBy(s => s.Amount).ToArray();

foreach(var coin in orderedCoins)
{
if(coin.Amount < target && total < target)
Expand Down

0 comments on commit 74632e6

Please sign in to comment.