Skip to content
This repository has been archived by the owner on Dec 16, 2024. It is now read-only.

Create addresses which are found in the network but are not in wallet-cli #184

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Daksh14
Copy link
Contributor

@Daksh14 Daksh14 commented Aug 22, 2023

If the a note is owned by a vk and that vk isn't in wallet, we create it in sequence and then save latest wallet file

Closes #80

Copy link
Member

@HDauven HDauven left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Please do update the changelog though.

src/clients/sync.rs Outdated Show resolved Hide resolved
if vk.owns(&note) {
if let Some(existing_addresses) = existing_addresses {
if existing_addresses.get(i).is_none() {
addresses_to_create.add_assign(1);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This way, you are loosing the index of the address you need to create.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additionally:

  • if you find multiple notes belonging to the same address, you're counting them multiple times
  • if there are no existing_address you're not counting at all
  • even if the above are fixed, what if I have 5 existing address and I find a note that belong to the address with index=50? Remember that we check notes against all MAX_Addresses

I suggest to change the behaviors to return the "max_address_index" found instead of the missing addresses count, and then create all the missing address to reach "max_address_index"

Anyway, some tests for this new feature would be welcome

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

del
3 participants