@@ -14,7 +14,7 @@ import Control.Concurrent.MVar (MVar, takeMVar)
1414import  Control.Monad  ((<=<) )
1515import  Control.Monad.IO.Class  (liftIO )
1616import  Control.Monad.State.Strict  (StateT , execStateT , gets , modify' )
17- import  Data.Aeson  (Value  (Object ), withObject , (.:) )
17+ import  Data.Aeson  (Value  (Object ), withObject , (.:) ,  (.:?) )
1818import  Data.Aeson.Types  (Parser , parseMaybe )
1919import  Data.Function  (on )
2020import  Data.List  (intercalate )
@@ -137,7 +137,7 @@ parseMessage "EBGenerated" item created =
137137    do 
138138      size <-  message .:  " size_bytes" 
139139      let  destination =  mempty {toEB =  created, inEBs =  S. singleton item, references =  Sum  1 }
140-       txs <-  mapM  (fmap  ((,destination) .  ItemKey  " TX"  ) .  (.:  " id"  )) =<<  message .:  " transactions" 
140+       txs <-  maybe  ( pure   [] ) ( mapM  (fmap  ((,destination) .  ItemKey  " TX"  ) .  (.:  " id"  )))  =<<  message .:?   " transactions" 
141141      ibs <-  mapM  (fmap  ((,destination) .  ItemKey  " IB"  ) .  (.:  " id"  )) =<<  message .:  " input_blocks" 
142142      ebs <-  mapM  (fmap  ((,destination) .  ItemKey  " EB"  ) .  (.:  " id"  )) =<<  message .:  " endorser_blocks" 
143143      pure  (ItemKey {kind =  " EB"  , item}, mempty {size, created}, M. fromList $  txs <>  ibs <>  ebs)
@@ -150,7 +150,7 @@ parseMessage "RBGenerated" item created =
150150          (pure  mempty )
151151          (fmap  (pure  .  (,mempty {toRB =  created, references =  Sum  1 }) .  ItemKey  " EB"  ) .  (.:  " id"  ) <=<  (.:  " eb"  ))
152152          =<<  message .:  " endorsement" 
153-       txs <-  fmap  ((,mempty {inRB =  created, references =  Sum  1 }) .  ItemKey  " TX"  ) <$>  message .:  " transactions" 
153+       txs <-  maybe   []  ( fmap  ((,mempty {inRB =  created, references =  Sum  1 }) .  ItemKey  " TX" ) ) <$>  message .:  " transactions" 
154154      pure  (ItemKey {kind =  " RB"  , item}, mempty {size, created}, M. fromList $  ebs <>  txs)
155155parseMessage _ _ _ = 
156156  const  $  fail  " Ignore" 
0 commit comments