Remove payerSwap from transaction sorting by price#525
Merged
tungng98 merged 6 commits intoBuildOnViction:pre-releasefrom Jun 9, 2025
Merged
Remove payerSwap from transaction sorting by price#525tungng98 merged 6 commits intoBuildOnViction:pre-releasefrom
tungng98 merged 6 commits intoBuildOnViction:pre-releasefrom
Conversation
…g-optional Make mine flag and etherbase optional
imduchuyyy
reviewed
May 30, 2025
| @@ -320,7 +320,7 @@ func (self *worker) update() { | |||
| acc, _ := types.Sender(self.current.signer, ev.Tx) | |||
| txs := map[common.Address]types.Transactions{acc: {ev.Tx}} | |||
| feeCapacity := state.GetTRC21FeeCapacityFromState(self.current.state) | |||
Contributor
There was a problem hiding this comment.
Can we remove feeCapacity to improve worker performance ?
Contributor
Author
There was a problem hiding this comment.
No, it's used in another function below.
Contributor
There was a problem hiding this comment.
you mean commitTransactions?
imduchuyyy
approved these changes
May 30, 2025
Collaborator
|
Can you explain what PayerSwap does? |
Contributor
Author
|
Contributor
|
Will an older transaction (TomoZ) be replaced by a new transaction with a higher gas price? |
tungng98
approved these changes
Jun 9, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The transactions should be sort by gas price but if the transaction is VRC25 tx the gas price will be treated as the same price (0.25 Gwei).
Introduction
This pull request refactors the
TxByPricesorting mechanism by simplifying its structure and removing special handling for TRC21 transactions. It also updates the corresponding test cases to ensure correctness and stability of the changes. The most important changes include the removal ofpayersSwapfrom theTxByPricestruct, updates to the sorting logic, and the addition of comprehensive test cases for transaction sorting.Refactoring and Simplification:
TxByPricestructure: ThepayersSwapfield was removed, and theTxByPricetype was redefined as an alias forTransactions, eliminating special handling for TRC21 transactions. This simplifies the sorting logic to rely solely on gas prices. (core/types/transaction.go) [1] [2]Less,Push, andPopto align with the simplifiedTxByPricestructure. Sorting now exclusively considers gas prices without any additional conditions. (core/types/transaction.go) [1] [2] [3]Test Enhancements:
core/types/transaction_test.go)core/types/transaction_test.go)Codebase Updates:
payersSwapparameter from theNewTransactionsByPriceAndNoncefunction and updated all its invocations accordingly. (core/types/transaction.go,miner/worker.go) [1] [2] [3]container/heapandsortto support the new test cases. (core/types/transaction_test.go)