----------------------------------------------------------------------------
-- Global
----------------------------------------------------------------------------

-- CHECK: @verifyToil
-- | Verify transactions correctness with respect to Utxo applying
-- them one-by-one.
-- Note: transactions must be topsorted to pass check.
-- Warning: this function may apply some transactions and fail
-- eventually.
--
-- If the 'Bool' argument is 'True', all data (script versions,
-- witnesses, addresses, attributes) must be known. Otherwise unknown
-- data is just ignored.
verifyToil ::
       ProtocolMagic
    -> TxValidationRules
    -> BlockVersionData
    -> Set Address
    -> EpochIndex
    -> Bool
    -> [TxAux]
    -> ExceptT ToilVerFailure UtxoM TxpUndo
verifyToil pm txValRules bvd lockedAssets curEpoch verifyAllIsKnown =
    mapM (verifyAndApplyTx pm txValRules bvd lockedAssets curEpoch verifyAllIsKnown . withTxId)
verifyToil ::
       ProtocolMagic
    -> TxValidationRules
    -> BlockVersionData
    -> Set Address
    -> EpochIndex
    -> Bool
    -> [TxAux]
    -> ExceptT ToilVerFailure UtxoM TxpUndo
verifyToil pm txValRules bvd lockedAssets curEpoch verifyAllIsKnown =
    mapM (verifyAndApplyTx pm txValRules bvd lockedAssets curEpoch verifyAllIsKnown . withTxId)
verifyToil pm txValRules bvd lockedAssets curEpoch verifyAllIsKnown =
    mapM (verifyAndApplyTx pm txValRules bvd lockedAssets curEpoch verifyAllIsKnown . withTxId)