Skip to content

Commit

Permalink
Garbage collect pools even if there are no new certificates.
Browse files Browse the repository at this point in the history
Our integration test suite currently creates all test stake pools at
the start of time, and from that point onwards never issues another
certificate.

If we want the effects of garbage collection to be visible from our
integration test suite, we must therefore allow the garbage collector
to run even in situations where there are no new certificates.

In reality, this will only impose a small overhead, as garbage
collection should only occur once per epoch.
  • Loading branch information
jonathanknowles committed Sep 21, 2020
1 parent 29a67fe commit 770da72
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions lib/shelley/src/Cardano/Wallet/Shelley/Pools.hs
Original file line number Diff line number Diff line change
Expand Up @@ -517,12 +517,8 @@ monitorStakePools tr gp nl db@DBLayer{..} = do
liftIO $ traceWith tr $ MsgErrProduction e
Right () ->
pure ()
unless (null certificates) $ do
-- Before adding new pool certificates to the database, we
-- first attempt to garbage collect pools that have already
-- retired.
garbageCollectPools slot latestGarbageCollectionEpochRef
putPoolCertificates slot certificates
garbageCollectPools slot latestGarbageCollectionEpochRef
putPoolCertificates slot certificates
pure Continue

-- Perform garbage collection for pools that have retired.
Expand Down

0 comments on commit 770da72

Please sign in to comment.