From 5fbb5c865ba91a5148fa5b5b1406a57c2e50aacd Mon Sep 17 00:00:00 2001 From: Rene Vergara Date: Tue, 19 Nov 2024 07:27:08 -0600 Subject: [PATCH] feat: implement commitment trees --- src/Zenith/CLI.hs | 59 ++++++++++++++++++++++------------------------- 1 file changed, 28 insertions(+), 31 deletions(-) diff --git a/src/Zenith/CLI.hs b/src/Zenith/CLI.hs index 3fbcdc2..2a6a5d4 100644 --- a/src/Zenith/CLI.hs +++ b/src/Zenith/CLI.hs @@ -878,7 +878,6 @@ scanZebra dbP zHost zPort b eChan znet = do liftIO $ BC.writeBChan eChan $ TickMsg "startSync" return () else do - liftIO $ BC.writeBChan eChan $ TickVal 1.0 liftIO $ BC.writeBChan eChan $ TickMsg "startSync" where processBlock :: ConnectionPool -> Float -> Int -> IO () @@ -928,36 +927,34 @@ appEvent (BT.AppEvent t) = do case s ^. displayBox of AddrDisplay -> return () MsgDisplay -> do - if m == "startSync" - then do - selWallet <- - do case L.listSelectedElement $ s ^. wallets of - Nothing -> do - let fWall = - L.listSelectedElement $ - L.listMoveToBeginning $ s ^. wallets - case fWall of - Nothing -> throw $ userError "Failed to select wallet" - Just (_j, w1) -> return w1 - Just (_k, w) -> return w - _ <- - liftIO $ - runStderrLoggingT $ - syncWallet - (Config - (s ^. dbPath) - (s ^. zebraHost) - (s ^. zebraPort) - "user" - "pwd" - 8080) - selWallet - updatedState <- BT.get - ns <- liftIO $ refreshWallet updatedState - BT.put ns - BT.modify $ set msg "" - BT.modify $ set displayBox BlankDisplay - else return () + when (m == "startSync") $ do + selWallet <- + do case L.listSelectedElement $ s ^. wallets of + Nothing -> do + let fWall = + L.listSelectedElement $ + L.listMoveToBeginning $ s ^. wallets + case fWall of + Nothing -> throw $ userError "Failed to select wallet" + Just (_j, w1) -> return w1 + Just (_k, w) -> return w + _ <- + liftIO $ + runStderrLoggingT $ + syncWallet + (Config + (s ^. dbPath) + (s ^. zebraHost) + (s ^. zebraPort) + "user" + "pwd" + 8080) + selWallet + updatedState <- BT.get + ns <- liftIO $ refreshWallet updatedState + BT.put ns + BT.modify $ set msg "" + BT.modify $ set displayBox BlankDisplay PhraseDisplay -> return () TxDisplay -> return () TxIdDisplay -> return ()