From d1063bed4810460620b6a69e37923ae32ec5c4d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20B=C4=83ncioiu?= Date: Thu, 31 Oct 2024 14:28:51 +0200 Subject: [PATCH] Fix isTransactionGreater(). --- txcache/selectionUsingMerges.go | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/txcache/selectionUsingMerges.go b/txcache/selectionUsingMerges.go index bf395c41..9eaab5e1 100644 --- a/txcache/selectionUsingMerges.go +++ b/txcache/selectionUsingMerges.go @@ -81,11 +81,17 @@ func mergeTwoBunchesOfTransactions(first BunchOfTransactions, second BunchOfTran // Equality is out of scope (not possible in our case). func isTransactionGreater(transaction *WrappedTransaction, otherTransaction *WrappedTransaction) bool { - // First, compare by fee (PLS CHANGE TO PPU) - cmpFee := transaction.TxFee.Cmp(otherTransaction.TxFee) - if cmpFee > 0 { + // First, compare by price per unit + if transaction.PricePerGasUnitQuotient > otherTransaction.PricePerGasUnitQuotient { return true - } else if cmpFee < 0 { + } + if transaction.PricePerGasUnitQuotient < otherTransaction.PricePerGasUnitQuotient { + return false + } + if transaction.PricePerGasUnitRemainder > otherTransaction.PricePerGasUnitRemainder { + return true + } + if transaction.PricePerGasUnitRemainder < otherTransaction.PricePerGasUnitRemainder { return false }