Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Speed up mempool reverify on policy change #892

Merged
merged 8 commits into from
Jul 11, 2019
4 changes: 3 additions & 1 deletion neo/Ledger/MemoryPool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -360,8 +360,10 @@ internal void UpdatePoolForBlockPersisted(Block block, Snapshot snapshot)

if (policyChanged)
{
long newFeePerByte = NativeContract.Policy.GetFeePerByte(snapshot);
foreach (PoolItem item in _unverifiedSortedTransactions.Reverse())
_system.Blockchain.Tell(item.Tx, ActorRefs.NoSender);
if(item.Tx.FeePerByte <= newFeePerByte)
_system.Blockchain.Tell(item.Tx, ActorRefs.NoSender);
_unverifiedTransactions.Clear();
_unverifiedSortedTransactions.Clear();
}
Expand Down