Skip to content

Commit be9677e

Browse files
committed
forget to forget_, add comment suggesting users call finalize instead
1 parent 695fe74 commit be9677e

File tree

1 file changed

+5
-4
lines changed
  • ouroboros-consensus-protocol/src/ouroboros-consensus-protocol/Ouroboros/Consensus/Protocol/Ledger

1 file changed

+5
-4
lines changed

ouroboros-consensus-protocol/src/ouroboros-consensus-protocol/Ouroboros/Consensus/Protocol/Ledger/HotKey.hs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,9 @@ data HotKey c m = HotKey
168168
-- PRECONDITION: the key is not poisoned.
169169
--
170170
-- POSTCONDITION: the signature is in normal form.
171-
, forget :: m ()
172-
-- ^ Securely erase the key and release its memory.
171+
, forget_ :: m ()
172+
-- ^ Securely erase the key and release its memory. User code should use
173+
-- 'finalize' instead (which forgets and then finalizes the 'HotKey').
173174
, finalize_ :: m ()
174175
-- ^ Release any resources held by the 'HotKey', except for the signing
175176
-- key itself. User code should use 'finalize' instead.
@@ -178,7 +179,7 @@ data HotKey c m = HotKey
178179
-- | Release all resources held by the 'HotKey', including the signing key
179180
-- itself. Use this exactly once per 'HotKey' instance.
180181
finalize :: Monad m => HotKey c m -> m ()
181-
finalize hotKey = forget hotKey >> finalize_ hotKey
182+
finalize hotKey = forget_ hotKey >> finalize_ hotKey
182183

183184
deriving via (OnlyCheckWhnfNamed "HotKey" (HotKey c m)) instance NoThunks (HotKey c m)
184185

@@ -348,7 +349,7 @@ mkHotKeyWith initialStateMay maxKESEvolutions keyThreadMay finalizer = do
348349
KESKey _ key -> do
349350
let evolution = kesEvolution kesStateInfo
350351
KES.signedKES () evolution toSign key
351-
, forget = unset
352+
, forget_ = unset
352353
, finalize_ = finalizer'
353354
}
354355
where

0 commit comments

Comments
 (0)