Skip to content

Commit

Permalink
getLatestPactStateAt: exclude tables created after the particular blo…
Browse files Browse the repository at this point in the history
…ckheight (#1821)

Change-Id: I1b6d2e1f53b10bd5578fdbee1a6bcd17d5bfd095
  • Loading branch information
chessai authored Feb 14, 2024
1 parent 800371c commit c97366d
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/Chainweb/Pact/Backend/PactState.hs
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,15 @@ getLatestPactStateAt db bh = do

tables <- liftIO $ getPactTableNames db

tablesCreatedAfter <- liftIO $ do
let qryText = "SELECT tablename FROM VersionedTableCreation WHERE createBlockheight > ?1"
rows <- Pact.qry db qryText [SInt (int bh)] [RText]
forM rows $ \case
[SText tbl] -> pure tbl
_ -> error "getLatestPactStateAt.tablesCreatedAfter: expected text"

forM_ tables $ \tbl -> do
when (tbl `notElem` excludedTables) $ do
when (tbl `notElem` (excludedTables ++ tablesCreatedAfter)) $ do
let qryText = "SELECT rowkey, rowdata, txid FROM "
<> "\"" <> tbl <> "\""
<> " WHERE txid<?"
Expand Down

0 comments on commit c97366d

Please sign in to comment.