intermediateHash :: Transaction -> Script -> ByteString
intermediateHash intermediateTransaction oldInputScript =
  convert . hashWith SHA256 $ bs
  where bs = BL.toStrict . Put.runPut $ do
          put (set (inputs.mapped.signatureScript) oldInputScript intermediateTransaction)
          Put.putWord32le sighashAll
intermediateHash :: Transaction -> Script -> ByteString
intermediateHash intermediateTransaction oldInputScript =
  convert . hashWith SHA256 $ bs
  where bs = BL.toStrict . Put.runPut $ do
          put (set (inputs.mapped.signatureScript) oldInputScript intermediateTransaction)
          Put.putWord32le sighashAll
intermediateHash intermediateTransaction oldInputScript =
  convert . hashWith SHA256 $ bs
  where bs = BL.toStrict . Put.runPut $ do
          put (set (inputs.mapped.signatureScript) oldInputScript intermediateTransaction)
          Put.putWord32le sighashAll