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

all: change TxPreEvent to TxsPreEvent #16720

Merged
merged 2 commits into from
May 19, 2018

Conversation

rjl493456442
Copy link
Member

@rjl493456442 rjl493456442 commented May 10, 2018

Currently, when a transaction is promoted, a TxPreEvent will be pushed to subscribers immediately.

While when the number of new transactions received is large, there are too many TxPreEvent will be pushed leads to txFeed lock resource contention.

So in this PR, i replace all TxPreEvent to TxsPreEvent. So that we can push a batch of new promoted txs together. It will help in these scenario:

  • Block reorganization(a bunch of transactions will be re-injected to txpool )
  • Improve transaction forwarding efficiency(Send a batch of transactions to peers instead of single one)
  • Relieving pressure on the system from websocket pending transaction subscriptions(Prevent slower socket write speeds from blocking txfeed)

Besides, in this PR, also fix a small problem.
When we apply new promoted transaction to mining block, it should sill abide original gas limit restriction instead of creating a new gas limit.

@rjl493456442 rjl493456442 changed the title WIP all: change TxPreEvent to TxsPreEvent all: change TxPreEvent to TxsPreEvent May 11, 2018
Copy link
Member

@karalabe karalabe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@holiman holiman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one typo

for _, err := range errs {
// Create a method to load a limited batch of transactions and bump the
// appropriate progress counters. Then use this method to load all the
// journelled transactions in small-ish batches.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/journelled/journalled/

core/tx_pool.go Outdated
@@ -653,7 +653,7 @@ func (pool *TxPool) add(tx *types.Transaction, local bool) (bool, error) {
log.Trace("Pooled new executable transaction", "hash", hash, "from", from, "to", tx.To())

// We've directly injected a replacement transaction, notify subsystems
go pool.txFeed.Send(TxsPreEvent{types.Transactions{tx}})
go pool.txFeed.Send(NewTxsEvent{types.Transactions{tx}})
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will it be better if we post the NewTxsEvent synchronously here?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Felix started looking into the synchronous postings, so I'd rather keep that can of worms in a separate pr.

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.

3 participants