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

client/asset/{btc,dcr}: maintain sync progress after losing peers #2008

Merged
merged 1 commit into from Jan 5, 2023

Conversation

itswisdomagain
Copy link
Member

Resolves #2006.

Sync target height becomes 0 (for btc) or the same as the wallet tip (for dcr) when the correct value cannot be inferred from connected peers when the connection to all peers is lost.

Fix: cache sync target height so the cached value is used when calculating sync progress even when there are no peers connected.

@chappjc chappjc added this to the 0.6/1.0 milestone Dec 27, 2022
client/asset/btc/spv_wrapper.go Outdated Show resolved Hide resolved
Comment on lines 792 to 793
// spv peers. This value is maintained even if the peer that reported the value
// later becomes disconnected.
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if this is an attack vector. Is the spv syncer smart enough not to include peers with bogus chain heights?

Copy link
Member Author

Choose a reason for hiding this comment

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

Probably not something we should rely on. Another thought I had, which now sounds more reasonable, is to only use the cached value if there are no more connected peers; otherwise the value reported by connected peers takes precedence. Will update.

@chappjc chappjc added the bug bug or bugfix label Dec 29, 2022
@chappjc chappjc merged commit f9d7a01 into decred:master Jan 5, 2023
@chappjc chappjc modified the milestones: 0.6, 0.5.9 Mar 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug bug or bugfix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Decred SPV 99.9%(or 100%) Sync progress on connectivity loss
4 participants