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

Feature: Separate local tx tracking from the priced field in the pool #21174

Closed
karalabe opened this issue Jun 4, 2020 · 1 comment · Fixed by #21478
Closed

Feature: Separate local tx tracking from the priced field in the pool #21174

karalabe opened this issue Jun 4, 2020 · 1 comment · Fixed by #21478

Comments

@karalabe
Copy link
Member

karalabe commented Jun 4, 2020

The notion of local transactions was added after the tx pool was implemented. The idea was that nodes should keep holding onto transactions that they themselves created, even if otherwise there are better ones in the network. The rationale is that even if currently the tx won't get included, later it might be. The way it was implemented is that eviction operations simply jump over any local tx.

If a node has a handful of local txs, and lots of remote ones, this logic works perfectly. It might happen that an eviction does a few more cycles to find a non-local cheap tx to drop, but it's negligible. However, if the node has 10Ks of local transactions (and maybe none non-local), then every single eviction will iterate over all the underpriced locals, just to find that there's nothing to evict. This becomes problematic.

A possible solution would be to completely separate out the notion of locals from the priced tx list, so that when we search for txs to evict, we never even consider the local ones. The catch is that tx promotion and demotion (and possibly others) would need to be extended to handle two sets of disjoint transactions at the same time. We also need special casing when an account is marked local for the first time, to move previous transactions from the same account from the priced list to the local list.

@poonai
Copy link

poonai commented Aug 9, 2020

Eviction is the iterating transaction queue. https://github.com/ethereum/go-ethereum/blob/master/core/tx_pool.go#L359

I'm thinking to separate the queue into localQueue and remoteQueue. The right queue will be chosen while promotion and demotion.

For eviction, we don't need to run over the local queue.

Is this the right way to find the solution?

@karalabe

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

Successfully merging a pull request may close this issue.

3 participants