@@ -4,19 +4,16 @@ module RSCoin.Explorer.Server
4
4
( serve
5
5
) where
6
6
7
-
8
7
import Control.Exception (throwIO )
9
8
import Control.Lens ((^.) )
10
- import Control.Monad (unless , void , when )
9
+ import Control.Monad (unless , when )
11
10
import Control.Monad.Extra (whenJust )
12
11
import Control.Monad.Trans (MonadIO (liftIO ))
13
- import Data.Acid (createArchive , createCheckpoint )
12
+ import Data.Acid (createCheckpoint )
14
13
import Data.Acid.Advanced (query' , update' )
15
- import qualified Data.Text as T
16
14
import Formatting (build , int , sformat , (%) )
17
- import System.FilePath ((</>) )
18
- import qualified Turtle.Prelude as TURT
19
15
16
+ import Serokell.Util.AcidState (createAndDiscardArchive )
20
17
import Serokell.Util.Text (listBuilderJSONIndent )
21
18
22
19
import qualified RSCoin.Core as C
@@ -76,13 +73,10 @@ handleNewHBlock ch st bankPublicKey storagePath newBlockId (newBlock,emission) s
76
73
{ ciTransactions = C. hbTransactions newBlock
77
74
}
78
75
liftIO $ createCheckpoint st
79
- whenJust storagePath $ \ stpath ->
80
- when (newBlockId `mod` 5 == 0 ) $ liftIO $ do
81
- createArchive st
82
- void $
83
- TURT. shellStrict
84
- (T. pack $ " rm -rf " ++ (stpath </> " Archive" ))
85
- (return " " )
76
+ whenJust storagePath $
77
+ \ stpath ->
78
+ when (newBlockId `mod` 5 == 0 ) $
79
+ createAndDiscardArchive st stpath
86
80
ret (newBlockId + 1 )
87
81
if expectedPid == newBlockId
88
82
then upd
0 commit comments