Skip to content

Commit

Permalink
Use explicit field names when constructing TxUpdate objects.
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanknowles committed Apr 30, 2024
1 parent 1c081a9 commit ffcf15b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
16 changes: 14 additions & 2 deletions lib/balance-tx/lib/internal/Internal/Cardano/Write/Tx/Balance.hs
Original file line number Diff line number Diff line change
Expand Up @@ -862,7 +862,13 @@ balanceTxInner
tx
timelockKeyWitnessCounts
minfee = Convert.toWalletCoin $ evaluateMinimumFee pp tx witCount
update = TxUpdate [] [] [] [] (UseNewTxFee minfee)
update = TxUpdate
{ extraInputs = []
, extraCollateral = []
, extraOutputs = []
, extraInputScripts = []
, feeUpdate = UseNewTxFee minfee
}
tx' <- left updateTxErrorToBalanceTxError $ updateTx tx update
let balance = txBalance tx'
minfee' = Convert.toLedgerCoin minfee
Expand Down Expand Up @@ -1167,7 +1173,13 @@ data TxUpdate = TxUpdate
-- == Right tx or Left
-- @
noTxUpdate :: TxUpdate
noTxUpdate = TxUpdate [] [] [] [] UseOldTxFee
noTxUpdate = TxUpdate
{ extraInputs = []
, extraCollateral = []
, extraOutputs = []
, extraInputScripts = []
, feeUpdate = UseOldTxFee
}

-- | Method to use when updating the fee of a transaction.
data TxFeeUpdate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ import Internal.Cardano.Write.Tx.Balance
, PartialTx (..)
, Redeemer (..)
, TxFeeUpdate (UseNewTxFee)
, TxUpdate (TxUpdate)
, TxUpdate (..)
, UTxOAssumptions (..)
, balanceTx
, constructUTxOIndex
Expand Down Expand Up @@ -1542,7 +1542,13 @@ prop_updateTx
-> W.Coin
-> Property
prop_updateTx tx extraIns extraCol extraOuts newFee = do
let extra = TxUpdate extraIns extraCol extraOuts [] (UseNewTxFee newFee)
let extra = TxUpdate
{ extraInputs = extraIns
, extraCollateral = extraCol
, extraOutputs = extraOuts
, extraInputScripts = []
, feeUpdate = UseNewTxFee newFee
}
let tx' = either (error . show) id
$ updateTx tx extra
conjoin
Expand Down

0 comments on commit ffcf15b

Please sign in to comment.