diff --git a/test/Chainweb/Test/Pact/ModuleCacheOnRestart.hs b/test/Chainweb/Test/Pact/ModuleCacheOnRestart.hs index f0ad4bf4c8..7276c752b6 100644 --- a/test/Chainweb/Test/Pact/ModuleCacheOnRestart.hs +++ b/test/Chainweb/Test/Pact/ModuleCacheOnRestart.hs @@ -49,12 +49,12 @@ import Chainweb.Time import Chainweb.Test.Cut import Chainweb.Test.Cut.TestBlockDb import Chainweb.Test.Utils +import Chainweb.Test.Pact.Utils (getPWOByHeader) import Chainweb.Test.TestVersions(fastForkingCpmTestVersion) import Chainweb.Utils (T2(..)) import Chainweb.Version import Chainweb.WebBlockHeaderDB -import Chainweb.Storage.Table (casLookupM) import Chainweb.Storage.Table.RocksDB testVer :: ChainwebVersion @@ -269,11 +269,6 @@ doNextCoinbase iobdb = do (valPWO, _g) <- execValidateBlock mempty nextH (payloadWithOutputsToPayloadData pwo) return (nextH, valPWO) -getPWOByHeader :: BlockHeader -> TestBlockDb -> IO PayloadWithOutputs -getPWOByHeader h (TestBlockDb _ pdb _) = do - pwo <- casLookupM pdb (_blockPayloadHash h) - return pwo - doNextCoinbaseN_ :: (Logger logger, CanReadablePayloadCas cas) => Int diff --git a/test/Chainweb/Test/Pact/PactMultiChainTest.hs b/test/Chainweb/Test/Pact/PactMultiChainTest.hs index 01ccd541b4..ff8e9f1554 100644 --- a/test/Chainweb/Test/Pact/PactMultiChainTest.hs +++ b/test/Chainweb/Test/Pact/PactMultiChainTest.hs @@ -1279,7 +1279,7 @@ rewindTo c = do Nothing -> error $ "rewindTo: can't find block header for " ++ show cid' -- reset the parent header using validateBlock - pout <- getPWOByHeader ph + pout <- liftIO $ getPWOByHeader ph bdb void $ liftIO $ _webPactValidateBlock pact ph (payloadWithOutputsToPayloadData pout) void $ liftIO $ swapMVar (_bdbCut bdb) c @@ -1444,12 +1444,6 @@ getPWO chid = do pwo <- liftIO $ casLookupM pdb (_blockPayloadHash h) return (pwo,h) -getPWOByHeader :: BlockHeader -> PactTestM PayloadWithOutputs -getPWOByHeader h = do - (TestBlockDb _ pdb _) <- view menvBdb - pwo <- liftIO $ casLookupM pdb (_blockPayloadHash h) - return pwo - getHeader :: ChainId -> PactTestM BlockHeader getHeader chid = do (TestBlockDb _ _ cmv) <- view menvBdb diff --git a/test/Chainweb/Test/Pact/Utils.hs b/test/Chainweb/Test/Pact/Utils.hs index 45d8ab0feb..c70c16bea1 100644 --- a/test/Chainweb/Test/Pact/Utils.hs +++ b/test/Chainweb/Test/Pact/Utils.hs @@ -107,7 +107,7 @@ module Chainweb.Test.Pact.Utils , someTestVersionHeader , someBlockHeader , testPactFilesDir - +, getPWOByHeader ) where import Control.Arrow ((&&&)) @@ -199,6 +199,7 @@ import Chainweb.Version.Utils (someChainId) import Chainweb.WebBlockHeaderDB import Chainweb.WebPactExecutionService +import Chainweb.Storage.Table (casLookupM) import Chainweb.Storage.Table.RocksDB -- ----------------------------------------------------------------------- -- @@ -865,3 +866,6 @@ someBlockHeader v h = (!! (int h - 1)) makeLenses ''CmdBuilder makeLenses ''CmdSigner + +getPWOByHeader :: BlockHeader -> TestBlockDb -> IO PayloadWithOutputs +getPWOByHeader h (TestBlockDb _ pdb _) = casLookupM pdb (_blockPayloadHash h)