Skip to content

Commit

Permalink
moar fee
Browse files Browse the repository at this point in the history
  • Loading branch information
teodanciu committed Nov 29, 2024
1 parent 8ba90ae commit 8efa94e
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ import Cardano.Ledger.BaseTypes
import Cardano.Ledger.Binary (DecCBOR, EncCBOR)
import Cardano.Ledger.Block (Block)
import Cardano.Ledger.CertState (certDStateL, dsUnifiedL)
import Cardano.Ledger.Coin (Coin (..))
import Cardano.Ledger.Coin
import Cardano.Ledger.Credential (Credential (..), StakeReference (..), credToText)
import Cardano.Ledger.Crypto (Crypto (..))
import Cardano.Ledger.Genesis (EraGenesis (..), NoGenesis (..))
Expand Down Expand Up @@ -252,6 +252,7 @@ import Data.List.NonEmpty (NonEmpty)
import Data.Map.Strict (Map)
import qualified Data.Map.Strict as Map
import Data.Maybe (catMaybes, mapMaybe)
import Data.Ratio ((%))
import Data.Sequence.Strict (StrictSeq (..))
import qualified Data.Sequence.Strict as SSeq
import qualified Data.Set as Set
Expand Down Expand Up @@ -1003,9 +1004,10 @@ fixupFees txOriginal = impAnn "fixupFees" $ do
txNoWits = tx & bodyTxL . outputsTxBodyL %~ (:|> changeBeforeFeeTxOut)
outsBeforeFee = tx ^. bodyTxL . outputsTxBodyL
suppliedFee = txOriginal ^. bodyTxL . feeTxBodyL
fee
fee0
| suppliedFee == zero = calcMinFeeTxNativeScriptWits utxo pp txNoWits nativeScriptKeyWits
| otherwise = suppliedFee
fee = rationalToCoinViaCeiling $ coinToRational fee0 * (11 % 10)
logString "Validating change"
change <- ensureNonNegativeCoin $ changeBeforeFeeTxOut ^. coinTxOutL <-> fee
logToExpr change
Expand Down

0 comments on commit 8efa94e

Please sign in to comment.