Skip to content

Commit

Permalink
fix alignedValidFlags in alonzo TxSeq decoding
Browse files Browse the repository at this point in the history
  • Loading branch information
Jared Corduan committed May 7, 2021
1 parent 053b207 commit 60f0cbd
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions alonzo/impl/src/Cardano/Ledger/Alonzo/TxSeq.hs
Original file line number Diff line number Diff line change
Expand Up @@ -271,8 +271,10 @@ nonValidatingIndices (StrictSeq.fromStrict -> xs) =
--
-- This function operates much as the inverse of 'nonValidatingIndices'.
alignedValidFlags :: Int -> [Int] -> Seq.Seq IsValidating
alignedValidFlags n [] = Seq.replicate n $ IsValidating True
alignedValidFlags n (x : xs) =
Seq.replicate (n - x) (IsValidating True)
Seq.>< IsValidating False
Seq.<| alignedValidFlags (n - x - 1) xs
alignedValidFlags = alignedValidFlags' (-1)
where
alignedValidFlags' _ n [] = Seq.replicate n $ IsValidating True
alignedValidFlags' prev n (x : xs) =
Seq.replicate (x - prev - 1) (IsValidating True)
Seq.>< IsValidating False
Seq.<| alignedValidFlags' x (n - (x - prev)) xs

0 comments on commit 60f0cbd

Please sign in to comment.