-
Notifications
You must be signed in to change notification settings - Fork 21.1k
Backport TxPool limits to release/1.4 #3116
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
Conversation
Thank you for your contribution! Your commits seem to not adhere to the repository coding standards
Please check the contribution guidelines for more details. This message was auto-generated by https://gitcop.com |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few stray comments
var drops types.Transactions | ||
|
||
sort.Sort(*m.index) | ||
for size := len(m.items); size > threshold; size-- { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm probably wrong, but it looks like it would be possible to remove all extraneous items in one go, instead of doing them one at a time in an loop...?
} | ||
// Otherwise start accumulating incremental transactions | ||
var ready types.Transactions | ||
for next := (*m.index)[0]; m.index.Len() > 0 && (*m.index)[0] == next; next++ { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks strange to me: for next := (*m.index)[0]; ...&& (*m.index)[0] == next
. Assignment first, then validating that the assignment worked?
// This method uses the cached costcap to quickly decide if there's even a point | ||
// in calculating all the costs or if the balance covers all. If the threshold is | ||
// lower than the costcap, the costcap will be reset to a new high after removing | ||
// expensive the too transactions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"the too expensive transactions"
maxQueued = 64 // max limit of queued txs per address | ||
var ( | ||
maxQueuedPerAccount = uint64(64) // Max limit of queued transactions per address | ||
maxQueuedInTotal = uint64(65536) // Max limit of queued transactions from all accounts |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't that a bit large? Seeing as how nodes are toppling at 10k transactions
delete(txs, hash) | ||
// Otherwise postpone any invalidated transactions | ||
for _, tx := range invalids { | ||
pool.enqueueTx(tx.Hash(), tx) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When the timer in expirationLoop
starts deleting transactions from an account, it will start by deleting the lowest nonce. It looks like litle loop here will add back all the resulting invalids, and expirationLoop
will have to iterate through all of them, rebuilding the cache in every loop. Looks suboptimal to me...?
(cherry picked from commit 16d8397)
Thank you for your contribution! Your commits seem to not adhere to the repository coding standards
Please check the contribution guidelines for more details. This message was auto-generated by https://gitcop.com |
Thank you for your contribution! Your commits seem to not adhere to the repository coding standards
Please check the contribution guidelines for more details. This message was auto-generated by https://gitcop.com |
This backports the changes from #2742.