Skip to content

Commit

Permalink
Make it green.. and leave another FIXME
Browse files Browse the repository at this point in the history
  • Loading branch information
ch1bo committed May 10, 2022
1 parent 36c1f9f commit bee9469
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions hydra-node/src/Hydra/Chain/Direct/Context.hs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import qualified Hydra.Crypto as Hydra
import Hydra.Ledger.Cardano (genOneUTxOFor, genTxIn, genVerificationKey, renderTx)
import Hydra.Party (Party, deriveParty)
import Hydra.Snapshot (ConfirmedSnapshot (..), Snapshot (..), genConfirmedSnapshot, getSnapshot)
import Test.QuickCheck (choose, elements, frequency, vector)
import Test.QuickCheck (choose, elements, frequency, suchThat, vector)

-- | Define some 'global' context from which generators can pick
-- values for generation. This allows to write fairly independent generators
Expand Down Expand Up @@ -161,8 +161,13 @@ genStClosed ::
Gen (OnChainHeadState 'StClosed)
genStClosed ctx utxo = do
(_, stOpen) <- genStOpen ctx
-- Any confirmed snapshot suffices here, no signatures are checked
confirmed <- arbitrary
-- FIXME: The fact that we need a ConfirmedSnapshot here is due to the fact
-- that the utxo's in an 'InitialSnapshot' are ignored and we would not be
-- able to fan them out
confirmed <-
arbitrary `suchThat` \case
InitialSnapshot{} -> False
ConfirmedSnapshot{} -> True
let snapshot = confirmed{snapshot = (getSnapshot confirmed){utxo = utxo}}
let closeTx = close snapshot stOpen
pure $ snd $ unsafeObserveTx @_ @ 'StClosed closeTx stOpen
Expand Down

0 comments on commit bee9469

Please sign in to comment.