Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Jonathan Knowles <jonathan.knowles@iohk.io>
  • Loading branch information
Anviking and jonathanknowles committed May 30, 2023
1 parent 64479aa commit 73091b9
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 11 deletions.
19 changes: 12 additions & 7 deletions lib/wallet/src/Cardano/Wallet.hs
Expand Up @@ -1879,19 +1879,17 @@ readNodeTipStateForTxWrite
:: NetworkLayer IO Read.Block
-> IO (Write.InAnyRecentEra Write.ProtocolParameters, TimeTranslation)
readNodeTipStateForTxWrite netLayer = do
let ti = timeInterpreter netLayer
timeTranslation <- toTimeTranslation ti
timeTranslation <- toTimeTranslation (timeInterpreter netLayer)

res <- currentLedgerProtocolParameters
<$> currentProtocolParameters netLayer

case Write.toRecentEraGADT res of
Right pp ->
pure (pp, timeTranslation)
Right pp -> pure (pp, timeTranslation)
Left era -> throwIO $ invalidEra era
where
invalidEra = ExceptionWriteTxEra
. ErrNodeNotYetInRecentEra
invalidEra =
ExceptionWriteTxEra . ErrNodeNotYetInRecentEra

-- | Build, Sign, Submit transaction.
--
Expand Down Expand Up @@ -2017,7 +2015,14 @@ buildAndSignTransactionPure
wallet <- get
(unsignedBalancedTx, updatedWalletState) <- lift $
buildTransactionPure @s @era
wallet timeTranslation utxoIndex txLayer changeAddrGen pp preSelection txCtx
wallet
timeTranslation
utxoIndex
txLayer
changeAddrGen
pp
preSelection
txCtx
put wallet { getState = updatedWalletState }

let mExternalRewardAccount = case view #txWithdrawal txCtx of
Expand Down
1 change: 0 additions & 1 deletion lib/wallet/src/Cardano/Wallet/Shelley/Compatibility.hs
Expand Up @@ -894,7 +894,6 @@ fromShelleyPParams eraInfo pp =
, minimumCollateralPercentage = 0
, executionUnitPrices = Nothing
, currentLedgerProtocolParameters = Write.InNonRecentEraShelley

}

fromAllegraPParams
Expand Down
9 changes: 6 additions & 3 deletions lib/wallet/src/Cardano/Wallet/Write/ProtocolParameters.hs
Expand Up @@ -25,6 +25,9 @@ newtype ProtocolParameters era = ProtocolParameters
:: Write.PParams (Write.ShelleyLedgerEra era)
}

deriving instance Eq (Write.PParams (Write.ShelleyLedgerEra era)) => Eq (ProtocolParameters era)
deriving instance Show (Write.PParams (Write.ShelleyLedgerEra era)) => Show (ProtocolParameters era)

deriving instance
Eq (Write.PParams (Write.ShelleyLedgerEra era)) =>
Eq (ProtocolParameters era)
deriving instance
Show (Write.PParams (Write.ShelleyLedgerEra era)) =>
Show (ProtocolParameters era)

0 comments on commit 73091b9

Please sign in to comment.