From 6567b393073b3c2d29a7a659c5bce0be6be86a8d Mon Sep 17 00:00:00 2001 From: Dmitry Zuikov Date: Thu, 1 Aug 2024 14:32:30 +0300 Subject: [PATCH] wip --- hbs2-cli/lib/HBS2/CLI/Run/RefLog.hs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/hbs2-cli/lib/HBS2/CLI/Run/RefLog.hs b/hbs2-cli/lib/HBS2/CLI/Run/RefLog.hs index 8ce1ba7b..8be66200 100644 --- a/hbs2-cli/lib/HBS2/CLI/Run/RefLog.hs +++ b/hbs2-cli/lib/HBS2/CLI/Run/RefLog.hs @@ -165,4 +165,18 @@ reflogEntries = do _ -> throwIO (BadFormException @C nil) + brief "list transactions from reflog" + $ entry $ bindMatch "hbs2:reflog:tx:parse" $ \case + [StringLike hash] -> do + + sto <- ContT withPeerStorage + hashref <- orThrowUser "bad hash" (fromStringMay @HashRef hash) + void $ hasBlock sto (fromHashRef hashref) `orDie` "no block" + let sref = AnnotatedHashRef Nothing hashref + rlu <- lift $ mkRefLogUpdateFrom reflog (pure $ LBS.toStrict $ serialise sref) <&> serialise + pure $ mkForm "blob" [mkStr (LBS8.unpack rlu)] + + _ -> throwIO (BadFormException @C nil) + +