Skip to content

Commit 5034ab9

Browse files
committed
[RSC-143] Fix bugs + cosmetics
1 parent 19a3359 commit 5034ab9

File tree

2 files changed

+7
-11
lines changed

2 files changed

+7
-11
lines changed

src/RSCoin/User/Operations.hs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -249,11 +249,6 @@ importAddress st (skMaybe,pk) fromH toH0 = do
249249
Just Nothing -> C.logInfo $ "The address doesn't have secret key, " <>
250250
"adding this one with re-query"
251251
Just (Just _) -> commitError "The address is already imported"
252-
allAddrs <- getAllPublicAddresses st
253-
when (C.Address pk `elem` allAddrs) $
254-
commitError $ sformat
255-
("Address " % build % " is already imported into wallet")
256-
newAddress
257252
when (fromH < 0) $ commitError $
258253
sformat ("Height 'from' " % int % " must be positive!") fromH
259254
whenJust toH0 $ \toH -> do
@@ -270,8 +265,11 @@ importAddress st (skMaybe,pk) fromH toH0 = do
270265
" where " % int %
271266
" is current wallet's top known blockchain height."
272267
in commitError $ sformat formatPattern fromH toH walletHeight walletHeight
268+
C.logInfo $ sformat
269+
("Starting blockchain query process for blocks " % int % ".." % int) fromH toH
273270
(txs,txHistoryRecords) <-
274271
execStateT (gatherTransactionsDo [fromH..toH]) ([],S.empty)
272+
C.logInfo "Ended blockchain query process"
275273
update' st $ A.AddAddress (newAddress,skMaybe)
276274
(nub $ map fst txs) txHistoryRecords
277275
where

src/User/Actions.hs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ import qualified Data.Text as T
3434
import Data.Text.Encoding (encodeUtf8)
3535
import qualified Data.Text.IO as TIO
3636
import Formatting (build, int, sformat, shown, stext,
37-
(%))
37+
string, (%))
3838

3939
import Serokell.Util.Text (show')
4040

@@ -148,7 +148,7 @@ processListAddresses st =
148148
unless (length coins < 2) $
149149
forM_ (tail coins)
150150
(TIO.putStrLn . sformat (spaces % build))
151-
unless hasSecret $ TIO.putStrLn " (!! This address doesn't have secret key"
151+
unless hasSecret $ TIO.putStrLn " (!) This address doesn't have secret key"
152152
case strategy of
153153
C.DefaultStrategy -> return ()
154154
C.MOfNStrategy m allowed -> do
@@ -345,7 +345,6 @@ processImportAddress st skPathMaybe pkPath heightFrom heightTo= do
345345
pk <- liftIO $ C.logInfo "Reading pk..." >> C.readPublicKey pkPath
346346
sk <- liftIO $ flip (maybe (return Nothing)) skPathMaybe $ \skPath ->
347347
C.logInfo "Reading sk..." >> Just <$> C.readSecretKey skPath
348-
C.logInfo "Starting blockchain query process"
349348
importAddress st (sk,pk) heightFrom heightTo
350349
C.logInfo "Finished, your address successfully added"
351350

@@ -384,9 +383,8 @@ processExportAddress st addrId filepath = do
384383
liftIO $ C.writePublicKey (filepath <> ".pub") pk
385384
C.logInfo $
386385
sformat
387-
("Dumped secret key into " % shown % ", public into " %
388-
shown %
389-
".pub")
386+
("Dumped secret key into '" % string %
387+
"', public into '" % string % ".pub'")
390388
filepath
391389
filepath
392390
C.MOfNStrategy m parties ->

0 commit comments

Comments
 (0)