Skip to content
This repository was archived by the owner on Aug 18, 2020. It is now read-only.

Commit 3c911b2

Browse files
committed
[CBR-379] Unify prefilterBlockForWallets and prefilterBlock
1 parent 77b854b commit 3c911b2

File tree

4 files changed

+8
-17
lines changed

4 files changed

+8
-17
lines changed

src/Cardano/Wallet/Kernel/BListener.hs

+2-2
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ import Cardano.Wallet.Kernel.DB.TxMeta.Types
4444
import Cardano.Wallet.Kernel.Internal
4545
import qualified Cardano.Wallet.Kernel.NodeStateAdaptor as Node
4646
import Cardano.Wallet.Kernel.PrefilterTx (PrefilteredBlock (..),
47-
prefilterBlockForWallets)
47+
prefilterBlock)
4848
import Cardano.Wallet.Kernel.Read (getWalletCredentials)
4949
import Cardano.Wallet.Kernel.Restore
5050
import qualified Cardano.Wallet.Kernel.Submission as Submission
@@ -70,7 +70,7 @@ prefilterBlock' pw b = do
7070
aux :: [(WalletId, EncryptedSecretKey)]
7171
-> ((BlockContext, Map HdAccountId PrefilteredBlock), [TxMeta])
7272
aux ws =
73-
let (conMap, conMeta) = prefilterBlockForWallets b ws
73+
let (conMap, conMeta) = prefilterBlock b ws
7474
in ((b ^. rbContext, conMap), conMeta)
7575

7676
data BackfillFailed

src/Cardano/Wallet/Kernel/PrefilterTx.hs

+4-13
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ module Cardano.Wallet.Kernel.PrefilterTx
77
, emptyPrefilteredBlock
88
, AddrWithId
99
, prefilterBlock
10-
, prefilterBlockForWallets
1110
, prefilterUtxo
1211
, UtxoWithAddrId
1312
, prefilterUtxo'
@@ -282,10 +281,10 @@ extendWithSummary (onlyOurInps,onlyOurOuts) utxoWithAddrId
282281
-- | Prefilter the transactions of a resolved block for the given wallets.
283282
--
284283
-- Returns prefiltered blocks indexed by HdAccountId.
285-
prefilterBlockForWallets :: ResolvedBlock
286-
-> [(WalletId, EncryptedSecretKey)]
287-
-> (Map HdAccountId PrefilteredBlock, [TxMeta])
288-
prefilterBlockForWallets block rawKeys =
284+
prefilterBlock :: ResolvedBlock
285+
-> [(WalletId, EncryptedSecretKey)]
286+
-> (Map HdAccountId PrefilteredBlock, [TxMeta])
287+
prefilterBlock block rawKeys =
289288
(Map.fromList
290289
$ map (mkPrefBlock (block ^. rbContext) inpAll outAll)
291290
$ Set.toList accountIds
@@ -310,14 +309,6 @@ prefilterBlockForWallets block rawKeys =
310309
toWalletKey :: (WalletId, EncryptedSecretKey) -> WalletKey
311310
toWalletKey (wid, esk) = (wid, keyToWalletDecrCredentials $ KeyForRegular esk)
312311

313-
-- Prefilter a block for a single wallet
314-
prefilterBlock :: ResolvedBlock
315-
-> WalletId
316-
-> EncryptedSecretKey
317-
-> (Map HdAccountId PrefilteredBlock, [TxMeta])
318-
prefilterBlock block wid esk =
319-
prefilterBlockForWallets block [(wid, esk)]
320-
321312
mkPrefBlock :: BlockContext
322313
-> Map HdAccountId (Set TxIn)
323314
-> Map HdAccountId (Map TxIn (TxOutAux, AddressSummary))

src/Cardano/Wallet/Kernel/Restore.hs

+1-1
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ mkPrefilter :: Kernel.PassiveWallet
163163
-> IO (Map HD.HdAccountId PrefilteredBlock, [TxMeta])
164164
mkPrefilter pw wId esk blund = blundToResolvedBlock (pw ^. walletNode) blund <&> \case
165165
Nothing -> (M.empty, [])
166-
Just rb -> prefilterBlock rb wId esk
166+
Just rb -> prefilterBlock rb [(wId,esk)]
167167

168168
-- | Begin a restoration for a wallet that is already known. This is used
169169
-- to put an existing wallet back into a restoration state when something has

src/Cardano/Wallet/WalletLayer/Kernel/Wallets.hs

+1-1
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ prefilter :: EncryptedSecretKey
161161
prefilter esk wallet wId blund =
162162
blundToResolvedBlock (wallet ^. Kernel.walletNode) blund <&> \case
163163
Nothing -> (Map.empty, [])
164-
Just rb -> prefilterBlock rb wId esk
164+
Just rb -> prefilterBlock rb [(wId,esk)]
165165

166166
-- | Updates the 'SpendingPassword' for this wallet.
167167
updateWallet :: MonadIO m

0 commit comments

Comments
 (0)