Skip to content

Commit 4a836e1

Browse files
committed
tx-generator: remove Mainnet assumption from ApiTest.hs
1 parent a242dc0 commit 4a836e1

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

bench/tx-generator/test/ApiTest.hs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ module Main (module Main) where
1414

1515
import Cardano.Api
1616
import qualified Cardano.Api.Ledger as Api
17-
import Cardano.Api.Shelley (fromPlutusData)
17+
import Cardano.Api.Shelley (fromPlutusData, sgNetworkMagic)
1818
import Cardano.Api.Internal.ProtocolParameters (ProtocolParameters (..))
1919

2020
#ifdef WITH_LIBRARY
@@ -117,7 +117,7 @@ main
117117
-- helper functions move them out-of-line, with an extra helper to
118118
-- avoid repeating the failure message.
119119
showFundCore :: IsShelleyBasedEra era => Maybe (AddressInEra era, Api.Coin) -> String
120-
showFundCore = maybe "fund check failed" show
120+
showFundCore = maybe "no fund found for given key in genesis" show
121121

122122
showBabbage :: Maybe (AddressInEra BabbageEra, Api.Coin) -> String
123123
showBabbage = ("Babbage: " ++) . showFundCore
@@ -136,14 +136,16 @@ checkFund nixService shelleyGenesis signingKey
136136
| AnyCardanoEra ConwayEra <- _nix_era nixService
137137
= showConway $ checkFundCore shelleyGenesis signingKey
138138
| otherwise
139-
= "ApiTest: unrecognized era"
139+
= "ApiTest.checkFund: unrecognized era"
140140

141141
checkFundCore ::
142142
IsShelleyBasedEra era
143143
=> ShelleyGenesis
144144
-> SigningKey PaymentKey
145145
-> Maybe (AddressInEra era, Api.Coin)
146-
checkFundCore = genesisInitialFundForKey Mainnet
146+
checkFundCore sg = genesisInitialFundForKey networkId sg
147+
where
148+
networkId = fromNetworkMagic $ NetworkMagic $ sgNetworkMagic sg
147149

148150
checkPlutusBuiltin :: FilePath -> IO ()
149151
#ifndef WITH_LIBRARY

0 commit comments

Comments
 (0)