From b68ef786a0060b722949306ec1dea77d934cea46 Mon Sep 17 00:00:00 2001 From: Emil Lai Date: Tue, 31 Oct 2023 20:07:43 +0100 Subject: [PATCH] Add todo --- .../src/Concordium/GlobalState/AccountMap/LMDB.hs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/concordium-consensus/src/Concordium/GlobalState/AccountMap/LMDB.hs b/concordium-consensus/src/Concordium/GlobalState/AccountMap/LMDB.hs index 1aba8bd96c..afe2f2e6d5 100644 --- a/concordium-consensus/src/Concordium/GlobalState/AccountMap/LMDB.hs +++ b/concordium-consensus/src/Concordium/GlobalState/AccountMap/LMDB.hs @@ -210,6 +210,8 @@ newtype AccountMapStoreMonad (m :: Type -> Type) (a :: Type) = AccountMapStoreMo deriving instance (MonadProtocolVersion m) => MonadProtocolVersion (AccountMapStoreMonad m) +-- todo: move these into Helpers.hs so they can be reused across the different lmdb database connections. + -- | Run a read-only transaction. asReadTransaction :: (MonadIO m, MonadReader r m, HasDatabaseHandlers r) => (DatabaseHandlers -> MDB_txn -> IO a) -> AccountMapStoreMonad m a asReadTransaction t = do @@ -266,7 +268,7 @@ instance where doInsert dbh txn accounts = do forM_ accounts $ \(accAddr, accIndex) -> do - storeReplaceRecord txn (dbh ^. accountMapStore) accAddr accIndex + storeRecord txn (dbh ^. accountMapStore) accAddr accIndex lookup a@(AccountAddress accAddr) = asReadTransaction $ \dbh txn -> withCursor txn (dbh ^. accountMapStore) $ \cursor -> do