Skip to content

Commit

Permalink
Merge pull request #61 from multiversx/fix-txcache-readme
Browse files Browse the repository at this point in the history
Mempool: fix readme about "isTransactionMoreValuableForNetwork"
  • Loading branch information
andreibancioiu authored Nov 29, 2024
2 parents da4eff4 + 5a5a12b commit 3182661
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion txcache/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ That is, for contract calls, the PPU is not equal to the gas price, but much low

Transaction **A** is considered **more valuable (for the Network)** than transaction **B** if **it has a higher PPU**.

If two transactions have the same PPU, they are ordered using an arbitrary, but deterministic rule: the transaction with the "lower" transaction hash "wins" the comparison.
If two transactions have the same PPU, they are ordered by gas limit (higher is better, promoting less "execution fragmentation"). In the end, they are ordered using an arbitrary, but deterministic rule: the transaction with the "lower" transaction hash "wins" the comparison.

Pseudo-code:

Expand All @@ -103,6 +103,12 @@ func isTransactionMoreValuableForNetwork(A, B):
return true
if A.ppu < B.ppu:
return false
if A.gasLimit > B.gasLimit:
return true
if A.gasLimit < B.gasLimit:
return false
return A.hash < B.hash
```

Expand Down

0 comments on commit 3182661

Please sign in to comment.