diff --git a/lib/core/src/Cardano/Wallet/Api/Server.hs b/lib/core/src/Cardano/Wallet/Api/Server.hs index e9c7101bcaf..fcc2f9eb0f7 100644 --- a/lib/core/src/Cardano/Wallet/Api/Server.hs +++ b/lib/core/src/Cardano/Wallet/Api/Server.hs @@ -470,9 +470,8 @@ wallets ctx = :<|> getUTxOsStatistics ctx deleteWallet - :: forall ctx s t k n. - ( s ~ SeqState n k - , ctx ~ ApiLayer s t k + :: forall ctx s t k. + ( ctx ~ ApiLayer s t k ) => ctx -> ApiT WalletId @@ -1009,15 +1008,8 @@ deleteByronWallet => ApiLayer s t k -> ApiT WalletId -> Handler NoContent -deleteByronWallet ctx (ApiT wid) = do - liftHandler $ withWorkerCtx ctx wid throwE $ - \worker -> W.deleteWallet worker wid - liftIO $ Registry.remove re wid - liftIO $ (df ^. #removeDatabase) wid - return NoContent - where - re = ctx ^. workerRegistry @s @k - df = ctx ^. dbFactory @s @k +deleteByronWallet = + deleteWallet getByronWallet :: forall t k. () diff --git a/lib/core/src/Cardano/Wallet/DB/Sqlite.hs b/lib/core/src/Cardano/Wallet/DB/Sqlite.hs index 6fc72584a8c..e33efb9c3d7 100644 --- a/lib/core/src/Cardano/Wallet/DB/Sqlite.hs +++ b/lib/core/src/Cardano/Wallet/DB/Sqlite.hs @@ -220,7 +220,6 @@ newDBFactory -- ^ Path to database directory, or Nothing for in-memory database -> IO (DBFactory IO s k) newDBFactory cfg tr mDatabaseDir = do - mvar <- newEmptyMVar case mDatabaseDir of Nothing -> pure DBFactory { withDatabase = \_ action -> @@ -228,20 +227,23 @@ newDBFactory cfg tr mDatabaseDir = do , removeDatabase = \_ -> pure () } - Just databaseDir -> pure DBFactory - { withDatabase = \wid action -> - withDBLayer cfg tracerDB (Just $ databaseFile wid) $ \(ctx,db) -> do - putMVar mvar ctx - action db - , removeDatabase = \wid -> do - let files = - [ databaseFile wid - , databaseFile wid <> "-wal" - , databaseFile wid <> "-shm" - ] - readMVar mvar >>= destroyDBLayer - mapM_ removePathForcibly files - } + Just databaseDir -> do + mvar <- newEmptyMVar + pure DBFactory + { withDatabase = \wid action -> + withDBLayer cfg tracerDB (Just $ databaseFile wid) + $ \(ctx,db) -> do + putMVar mvar ctx + action db + , removeDatabase = \wid -> do + let files = + [ databaseFile wid + , databaseFile wid <> "-wal" + , databaseFile wid <> "-shm" + ] + readMVar mvar >>= destroyDBLayer + mapM_ removePathForcibly files + } where databaseFilePrefix = keyTypeDescriptor $ Proxy @k databaseFile wid =