Skip to content

Commit

Permalink
Revert Policy1
Browse files Browse the repository at this point in the history
  • Loading branch information
belane committed Nov 9, 2018
1 parent bb75f4d commit b43905b
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions SimplePolicy/SimplePolicyPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,22 @@ public bool FilterForMemoryPool(Transaction tx)
}

public IEnumerable<Transaction> FilterForBlock(IEnumerable<Transaction> transactions)
{
return FilterForBlock_Policy2(transactions);
}

private static IEnumerable<Transaction> FilterForBlock_Policy1(IEnumerable<Transaction> transactions)
{
int count = 0, count_free = 0;
foreach (Transaction tx in transactions.OrderByDescending(p => p.NetworkFee / p.Size).ThenByDescending(p => p.NetworkFee))
{
if (count++ >= Settings.Default.MaxTransactionsPerBlock - 1) break;
if (!tx.IsLowPriority || count_free++ < Settings.Default.MaxFreeTransactionsPerBlock)
yield return tx;
}
}

private static IEnumerable<Transaction> FilterForBlock_Policy2(IEnumerable<Transaction> transactions)
{
if (!(transactions is IReadOnlyList<Transaction> tx_list))
tx_list = transactions.ToArray();
Expand Down

0 comments on commit b43905b

Please sign in to comment.