diff --git a/changes/2024-06-19T182611-0400.txt b/changes/2024-06-19T182611-0400.txt new file mode 100644 index 0000000000..f09e731a21 --- /dev/null +++ b/changes/2024-06-19T182611-0400.txt @@ -0,0 +1 @@ +Speed up read-only replay by avoiding playing empty blocks diff --git a/src/Chainweb/Pact/PactService.hs b/src/Chainweb/Pact/PactService.hs index cf4554eed4..34e3143392 100644 --- a/src/Chainweb/Pact/PactService.hs +++ b/src/Chainweb/Pact/PactService.hs @@ -824,7 +824,10 @@ execReadOnlyReplay lowerBound maybeUpperBound = pactLabel "execReadOnlyReplay" $ liftIO $ writeIORef heightRef (_blockHeight bh) payload <- liftIO $ fromJuste <$> lookupPayloadDataWithHeight pdb (Just $ _blockHeight bh) (_blockPayloadHash bh) - void $ execBlock bh (CheckablePayload payload) + let isPayloadEmpty = V.null (_payloadDataTransactions payload) + let isUpgradeBlock = isJust $ _chainwebVersion bhdb ^? versionUpgrades . onChain (_chainId bhdb) . ix (_blockHeight bh) + unless (isPayloadEmpty && not isUpgradeBlock) $ + void $ execBlock bh (CheckablePayload payload) ) validationFailed <- readIORef validationFailedRef when validationFailed $