Skip to content

Commit

Permalink
Shorten name of field to genChangeAddress.
Browse files Browse the repository at this point in the history
This is (arguably) more direct, and still consistent with the purpose of
this function, which is to generate a new change address.
  • Loading branch information
jonathanknowles committed Nov 16, 2023
1 parent ecdc5d0 commit 467f4e0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1171,15 +1171,15 @@ data ChangeAddressGen s = ChangeAddressGen
{
-- | Generates a new change address.
--
getChangeAddressGen :: s -> (Address, s)
genChangeAddress :: s -> (Address, s)

-- | Returns a /dummy/ change address of the maximum possible length for
-- this generator.
--
-- Implementations must satisfy the following property:
--
-- @
-- ∀ s. length (fst (getChangeAddressGen s)) <=
-- ∀ s. length (fst (genChangeAddress s)) <=
-- length maxLengthChangeAddress
-- @
--
Expand Down
4 changes: 2 additions & 2 deletions lib/wallet/test/unit/Internal/Cardano/Write/Tx/BalanceSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,7 @@ spec_balanceTransaction = describe "balanceTransaction" $ do
let expectedChange = fmap Convert.toWalletAddress <$>
flip evalState s0
$ replicateM nChange
$ state @Identity (getChangeAddressGen dummyChangeAddrGen)
$ state @Identity (genChangeAddress dummyChangeAddrGen)

let address :: Babbage.BabbageTxOut StandardBabbage -> W.Address
address (Babbage.BabbageTxOut addr _ _ _) = Convert.toWallet addr
Expand Down Expand Up @@ -2369,7 +2369,7 @@ costModelsForTesting = either (error . show) id $ do

dummyChangeAddrGen :: ChangeAddressGen DummyChangeState
dummyChangeAddrGen = ChangeAddressGen
{ getChangeAddressGen = \(DummyChangeState i) ->
{ genChangeAddress = \(DummyChangeState i) ->
(addressAtIx $ toEnum i, DummyChangeState $ succ i)
, maxLengthChangeAddress = addressAtIx minBound
}
Expand Down

0 comments on commit 467f4e0

Please sign in to comment.