Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix wallet sync bug #446

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Fix wallet sync bug #446

wants to merge 2 commits into from

Conversation

panleone
Copy link
Member

@panleone panleone commented Nov 1, 2024

Abstract

With the latest shield-lib updates the number of transactions in the wallet doesn't correspond to the number of transactions returned by blockbook (because blockbook doesn't return shield txs that are not linkable to the user xpub).

In other words

const txNumber =
            (await cNet.getNumPages(nStartHeight, addr)) -
            this.getTransactions().length;

is potentially smaller than the actual number of missing transactions, therefore some transactions might be never fetched.

The bug is solved by asking for pages of transactions until we find a duplicate.

The problem of this approach is that we don't know anymore how long it will take ( to show in a progress bar)

EDIT:

Found a way to solve the bug without changing the transparentSync logic

@panleone panleone added the Bug This is either a bugfix (PR) or a bug (issue). label Nov 1, 2024
@panleone panleone self-assigned this Nov 1, 2024
Copy link

netlify bot commented Nov 1, 2024

Deploy Preview for cheery-moxie-4f1121 ready!

Name Link
🔨 Latest commit 5ce0558
🔍 Latest deploy log https://app.netlify.com/sites/cheery-moxie-4f1121/deploys/6724b68727954b0008b05029
😎 Deploy Preview https://deploy-preview-446--cheery-moxie-4f1121.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@JSKitty
Copy link
Member

JSKitty commented Nov 1, 2024

Could we not just filter out Shield transactions when calculating the txNumber so that it matches Blockbook? Given this is the transparent-only sync flow, we should be able to just deduct the Shield Tx count and then work on fetching the relevant Public Txs.

Am I missing something?

Copy link
Member

@JSKitty JSKitty left a comment

Choose a reason for hiding this comment

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

tACK 5ce0558

Very clean code, and I like that transparent sync no longer relies on txNumber to compute the total pages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug This is either a bugfix (PR) or a bug (issue).
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants