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

txpool pricedlist only reheap when pool is full #175

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

andyzhang2023
Copy link
Contributor

Description

The pricedlist LegacyTxpool.priced is used to evict transactions when the pool overflows. It sorts all remote pending transactions by nonce and price and decides which transaction to stay and which to remove. It only works when the pool is full, but re-heap every second when the state of the pool changes.. The cost of re-heap is hight because it re-sorts all the pending transactions.

This improvement changes it to "only re-heap when the pool overflows", so that:

  1. LegacyTxpool.runReorg() cost less time to update the whole state of the pool.
  2. LegacyTxpool.Add() can be called more because it shares the mu.Lock with LegacyTxpool.runReorg()
  3. some other calls who share the mu.Lock too will get lower latency just as the LegacyTxpool.Add() does.

All of these will support higher TPS on the pool.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants