wip, fixed refchan head pretty printing

This commit is contained in:
Dmitry Zuikov 2024-04-10 12:13:23 +03:00
parent 73193b5511
commit a1f2942610
1 changed files with 7 additions and 4 deletions

View File

@ -272,13 +272,13 @@ instance (ForRefChans e
<>
parens ("wait" <+> pretty (view refChanHeadWaitAccept blk)) <> line
<>
vcat (fmap peer (HashMap.toList $ view refChanHeadPeers blk)) <> line
lstOf peer (HashMap.toList $ view refChanHeadPeers blk)
<>
vcat (fmap author (HashSet.toList $ view refChanHeadAuthors blk)) <> line
lstOf author (HashSet.toList $ view refChanHeadAuthors blk)
<>
vcat (fmap reader (HashSet.toList $ view refChanHeadReaders blk)) <> line
lstOf reader (HashSet.toList $ view refChanHeadReaders blk)
<>
vcat (fmap notifier (HashSet.toList $ view refChanHeadNotifiers blk)) <> line
lstOf notifier (HashSet.toList $ view refChanHeadNotifiers blk)
where
peer (p,w) = parens ("peer" <+> dquotes (pretty (AsBase58 p)) <+> pretty w)
@ -286,6 +286,9 @@ instance (ForRefChans e
reader p = parens ("reader" <+> dquotes (pretty (AsBase58 p)))
notifier p = parens ("notifier" <+> dquotes (pretty (AsBase58 p)))
lstOf f e | null e = mempty
| otherwise = vcat (fmap f e) <> line
-- блок головы может быть довольно большой.
-- поэтому посылаем его, как merkle tree