Skip to content

Commit

Permalink
modify rollback property to capture the rollback in-within epoch prob…
Browse files Browse the repository at this point in the history
…lem. It now fails
  • Loading branch information
KtorZ committed Dec 18, 2019
1 parent 052975a commit 18852c0
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/core/test/unit/Cardano/Pool/DB/Properties.hs
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ prop_poolRegistration DBLayer {..} entries =
prop_rollbackRegistration
:: DBLayer IO
-> SlotId
-> [(EpochNo, PoolRegistrationCertificate)]
-> [(SlotId, PoolRegistrationCertificate)]
-> Property
prop_rollbackRegistration DBLayer{..} rollbackPoint entries =
monadicIO (setup >> prop)
Expand All @@ -394,16 +394,16 @@ prop_rollbackRegistration DBLayer{..} rollbackPoint entries =
case L.find (on (==) poolId pool . snd) entries of
Nothing ->
error "unknown pool?"
Just (ep, pool') ->
(ep <= epochNumber rollbackPoint) &&
(pool == pool')
Just (sl, pool') ->
(sl <= rollbackPoint) && (pool == pool')

ownerHasManyPools =
let owners = concatMap (poolOwners . snd) entries
in L.length owners > L.length (L.nub owners)

prop = do
run . atomically $ mapM_ (uncurry putPoolRegistration) entries
run . atomically $ forM_ entries $ \(sl, pool) ->
putPoolRegistration (epochNumber sl) pool
run . atomically $ rollbackTo rollbackPoint
pools <- run . atomically $ L.sort . catMaybes
<$> mapM (readPoolRegistration . poolId . snd) entries
Expand Down

0 comments on commit 18852c0

Please sign in to comment.