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

Commit 2e34020

Browse files
committed
[CBR-466] fix address reported as unused during restoration
1 parent 70edf77 commit 2e34020

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

wallet-new/src/Cardano/Wallet/Kernel/DB/HdWallet.hs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ module Cardano.Wallet.Kernel.DB.HdWallet (
5555
, hdAccountName
5656
, hdAccountState
5757
, hdAccountStateCurrent
58+
, hdAccountStateCurrentCombined
5859
, hdAccountStateUpToDate
5960
, hdAccountRestorationState
6061
-- *** Account state: up to date
@@ -475,6 +476,16 @@ hdAccountStateCurrent g = to $ \case
475476
HdAccountStateIncomplete st ->
476477
st ^. hdIncompleteCurrent . unCheckpoints . _Wrapped . SNE.head . g
477478

479+
hdAccountStateCurrentCombined :: (a -> a -> a)
480+
-> (forall c. IsCheckpoint c => Getter c a)
481+
-> Getter HdAccountState a
482+
hdAccountStateCurrentCombined combine g = to $ \case
483+
HdAccountStateUpToDate st ->
484+
st ^. hdUpToDateCheckpoints . unCheckpoints . _Wrapped . SNE.head . g
485+
HdAccountStateIncomplete st ->
486+
combine (st ^. hdIncompleteCurrent . unCheckpoints . _Wrapped . SNE.head . g)
487+
(st ^. hdIncompleteHistorical . unCheckpoints . _Wrapped . SNE.head . g)
488+
478489
{-------------------------------------------------------------------------------
479490
Predicates and tests
480491
-------------------------------------------------------------------------------}

wallet-new/src/Cardano/Wallet/WalletLayer/Kernel/Conv.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ toAddress acc hdAddress =
200200
(V1 addressOwnership)
201201
where
202202
cardanoAddress = hdAddress ^. HD.hdAddressAddress . fromDb
203-
addressMeta = acc ^. HD.hdAccountState . HD.hdAccountStateCurrent (cpAddressMeta cardanoAddress)
203+
addressMeta = acc ^. HD.hdAccountState . HD.hdAccountStateCurrentCombined (<>) (cpAddressMeta cardanoAddress)
204204
-- NOTE
205205
-- In this particular case, the address had to be known by us. As a matter
206206
-- of fact, to construct a 'WalletAddress', we have to be aware of pieces

0 commit comments

Comments
 (0)