Skip to content

Commit

Permalink
Add todo
Browse files Browse the repository at this point in the history
  • Loading branch information
MilkywayPirate committed Oct 31, 2023
1 parent d331c8e commit b68ef78
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit b68ef78

Please sign in to comment.