Skip to content

Commit

Permalink
reset and fix memorypool.ReverifyTransactions
Browse files Browse the repository at this point in the history
  • Loading branch information
Luchuan committed Nov 18, 2019
1 parent a156012 commit c18c09d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion neo/Ledger/MemoryPool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,10 @@ internal void InvalidateAllTransactions()
foreach (PoolItem item in unverifiedSortedTxPool.Reverse().Take(count))
{
if (item.Tx.Reverify(snapshot, SendersFeeMonitor.GetSenderFee(item.Tx.Sender)))
{
reverifiedItems.Add(item);
SendersFeeMonitor.AddSenderFee(item.Tx);
}
else // Transaction no longer valid -- it will be removed from unverifiedTxPool.
invalidItems.Add(item);

Expand All @@ -440,7 +443,7 @@ internal void InvalidateAllTransactions()
{
if (_unsortedTransactions.TryAdd(item.Tx.Hash, item))
{
SendersFeeMonitor.AddSenderFee(item.Tx);

verifiedSortedTxPool.Add(item);

if (item.LastBroadcastTimestamp < rebroadcastCutOffTime)
Expand All @@ -449,6 +452,8 @@ internal void InvalidateAllTransactions()
item.LastBroadcastTimestamp = DateTime.UtcNow;
}
}
else
SendersFeeMonitor.RemoveSenderFee(item.Tx);

_unverifiedTransactions.Remove(item.Tx.Hash);
unverifiedSortedTxPool.Remove(item);
Expand Down

0 comments on commit c18c09d

Please sign in to comment.