Skip to content

Commit

Permalink
Ensuring Object Reference check of SortedSets for speed-up (#557)
Browse files Browse the repository at this point in the history
  • Loading branch information
vncoelho authored and jsolman committed Jan 17, 2019
1 parent ab8bb4d commit 0e5434c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions neo/Ledger/MemoryPool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ private PoolItem GetLowestFeeTransaction(out Dictionary<UInt256, PoolItem> unsor

if (minItem != null)
{
unsortedTxPool = sortedPool == _unverifiedSortedLowPriorityTransactions
unsortedTxPool = Object.ReferenceEquals(sortedPool, _unverifiedSortedLowPriorityTransactions)
? _unverifiedTransactions : _unsortedTransactions;
return minItem;
}
Expand All @@ -291,7 +291,7 @@ private PoolItem GetLowestFeeTransaction(out Dictionary<UInt256, PoolItem> unsor
}
finally
{
unsortedTxPool = sortedPool == _unverifiedSortedHighPriorityTransactions
unsortedTxPool = Object.ReferenceEquals(sortedPool, _unverifiedSortedHighPriorityTransactions)
? _unverifiedTransactions : _unsortedTransactions;
}
}
Expand Down Expand Up @@ -446,7 +446,7 @@ private int ReverifyTransactions(SortedSet<PoolItem> verifiedSortedTxPool,
_txRwLock.EnterWriteLock();
try
{
int blocksTillRebroadcast = unverifiedSortedTxPool == _sortedHighPrioTransactions
int blocksTillRebroadcast = Object.ReferenceEquals(unverifiedSortedTxPool, _sortedHighPrioTransactions)
? BlocksTillRebroadcastHighPriorityPoolTx : BlocksTillRebroadcastLowPriorityPoolTx;

if (Count > RebroadcastMultiplierThreshold)
Expand Down

0 comments on commit 0e5434c

Please sign in to comment.