Skip to content

Commit 3b6dbe0

Browse files
authored
Merge pull request #4765 from input-output-hk/fix-genesis-create-staked-distribution
cardano-cli | create-staked: fix UTxO size distribution
2 parents 834b4ad + 30569c0 commit 3b6dbe0

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

cardano-cli/src/Cardano/CLI/Shelley/Run/Genesis.hs

+4-5
Original file line numberDiff line numberDiff line change
@@ -754,7 +754,7 @@ runGenesisCreateStaked (GenesisDir rootdir)
754754
writeFileGenesis (rootdir </> "genesis.alonzo.json") alonzoGenesis
755755
--TODO: rationalise the naming convention on these genesis json files.
756756

757-
liftIO $ Text.putStrLn $ mconcat $
757+
liftIO $ Text.hPutStrLn stderr $ mconcat $
758758
[ "generated genesis with: "
759759
, textShow genNumGenesisKeys, " genesis keys, "
760760
, textShow genNumUTxOKeys, " non-delegating UTxO keys, "
@@ -1141,10 +1141,9 @@ updateCreateStakedOutputTemplate
11411141
delegCoin = fromIntegral amountDeleg
11421142

11431143
distribute :: Integer -> Int -> [AddressInEra ShelleyEra] -> [(AddressInEra ShelleyEra, Lovelace)]
1144-
distribute funds nAddrs addrs = zip addrs (fmap Lovelace (coinPerAddr + rest:repeat coinPerAddr))
1145-
where coinPerAddr :: Integer
1146-
coinPerAddr = funds `div` fromIntegral nAddrs
1147-
rest = coinPerAddr * fromIntegral nAddrs
1144+
distribute funds nAddrs addrs = zip addrs (fmap Lovelace (coinPerAddr + remainder:repeat coinPerAddr))
1145+
where coinPerAddr, remainder :: Integer
1146+
(,) coinPerAddr remainder = funds `divMod` fromIntegral nAddrs
11481147

11491148
mkStuffedUtxo :: [AddressInEra ShelleyEra] -> [(AddressInEra ShelleyEra, Lovelace)]
11501149
mkStuffedUtxo xs = (, Lovelace minUtxoVal) <$> xs

0 commit comments

Comments
 (0)