-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Description
Description
While attempting to resolve #8954, I first tried to understand fully how it is implemented in the cli since woodser linked to the code snippet where it shows that there are class member variables m_subaddress_lookahead_major and m_subaddress_lookahead_minor that gets updated and saved to the wallet cache, but this made me realize that the m_subaddresses table of m_wallet is never actually updated and prompted me to test it, finding that it does not actually make the wallet "look ahead" any further.
User Impact
Users that have used many subaddresses may not be able to find their e-notes after restoring from their seed when adjusting the lookahead with set subaddress-lookahead
How to Reproduce
- create a new wallet:
wallet_1 - run
set- this will show the lookahead set to the default, 50:200 set subaddress-lookahead 50:300- run
setagain - this will now show 50:300 - (optional) close and reopen the wallet then run
setagain to confirm the change has persisted - export the wallet seed and create a new wallet by restoring from the seed to create
wallet_2 - in
wallet_2, runaddress new300 times - run
address all - copy one of the subaddresses from the 210-290 range
- send some moneroj from a different wallet to that address from step 9.
- wait until the transaction is confirmed
- open and refresh
wallet_1andwallet_2 - you will see a new transaction in
wallet_2but notwallet_1 - run
setin each wallet one more time to confirm that the subaddress-lookahead should be the same (they will both display 50:300) but they are in fact different, evidenced by the balance difference indicating thatwallet_1's subaddress pubkey hashtable has not been properly updated to "lookahead" past the 200th subaddress to the 300th subaddress.
How to Fix
Modify wallet2::set_subaddress_lookahead to actually expand/shrink the m_subaddresses class member variable based on the input.