Skip to content

Commit

Permalink
Make delistPools replace the set of delisted pools.
Browse files Browse the repository at this point in the history
We must replace the set of delisted pools, rather than augmenting it.

In response to review feedback:

#2277 (comment)
  • Loading branch information
jonathanknowles committed Oct 28, 2020
1 parent 35e29f8 commit b67c89f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/core/src/Cardano/Pool/DB/Model.hs
Expand Up @@ -432,7 +432,7 @@ mRollbackTo ti point = do
| otherwise = Nothing

mDelistPools :: [PoolId] -> ModelOp ()
mDelistPools = modify #delisted . Set.union . Set.fromList
mDelistPools = modify #delisted . const . Set.fromList

mReadDelistedPools :: ModelOp [PoolId]
mReadDelistedPools = Set.toList <$> get #delisted
Expand Down
5 changes: 3 additions & 2 deletions lib/core/src/Cardano/Pool/DB/Sqlite.hs
Expand Up @@ -491,8 +491,9 @@ newDBLayer trace fp timeInterpreter = do
deleteWhere [ BlockSlot >. point ]
-- TODO: remove dangling metadata no longer attached to a pool

delistPools =
insertMany_ . fmap PoolDelistment
delistPools pools = do
deleteWhere ([] :: [Filter PoolDelistment])
insertMany_ $ fmap PoolDelistment pools

readDelistedPools =
fmap (delistedPoolId . entityVal) <$> selectList [] []
Expand Down

0 comments on commit b67c89f

Please sign in to comment.