hermeznetwork / hermez-node

Hermez node Go implementation
GNU Affero General Public License v3.0
58 stars 33 forks source link

Feature/tx selector sort txs by profitability #1072

Closed tclemos closed 3 years ago

tclemos commented 3 years ago

Closes #266.

What does this PR does?

Adjust the transaction selector to select transactions by profitability instead of only by Nonce.

How to test?

Send transactions with different sender accounts and fees, the batch forged with these transactions must have the transactions with greater fees selected before the ones with smaller fees between transactions with different sender accounts, but respecting the Nonce sequence for each specific sender account.

These are the batches containing 3000 transactions already forged using the version of this PR to sort the transactions by profitability in the internal testnet network. image

Checklist

These are the criteria that every PR should meet, please check them off as you review them:

tclemos commented 3 years ago

The code seems to be ok and I am going to approve it. However, I just would like to do a small confirmation: if I send a transaction with a wrong nonce the heznode with this modification will block and mark this transaction with a wrong nonce as invalid?

Yes, nothing was changed regarding the rules to decide if a transaction is valid or not, the change just affects the order they are selected.