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

spv: Fix request of new blocks after initial sync #2390

Merged
merged 1 commit into from
Jun 21, 2024

Conversation

matheusd
Copy link
Member

This fixes an issue where SPV wallets would only request blocks from peers after a new block was mined.

The issue could be triggered if the number of peers ever dropped to zero, causing the SPV syncer to consider itself unsynced, and if blocks were mined in the intervening period until a new peer was connected.

The root cause was the addition of the unsynced status on the refactoring made in commit 6cde2cc. That made the sync status atomic decoupled to the state of the initialSyncDone signalling channel, which meant that if the atomic was switched to zero after the initial sync was done, new headers would fail to be requested from newly connected peers.

Upon further review, the check is ultimately unnecessary and is removed in this commit ensuring that, after initial sync is completed, the headers are asked of every peer.

This fixes an issue where SPV wallets would only request blocks from
peers after a new block was mined.

The issue could be triggered if the number of peers ever dropped to
zero, causing the SPV syncer to consider itself unsynced, and if blocks
were mined in the intervening period until a new peer was connected.

The root cause was the addition of the unsynced status on the
refactoring made in commit 6cde2cc. That made the sync status atomic
decoupled to the state of the initialSyncDone signalling channel, which
meant that if the atomic was switched to zero after the initial sync was
done, new headers would fail to be requested from newly connected peers.

Upon further review, the check is ultimately unnecessary and is removed
in this commit ensuring that, after initial sync is completed, the
headers are asked of every peer.
@jrick jrick merged commit 794fff4 into decred:master Jun 21, 2024
2 checks passed
@matheusd matheusd deleted the fix-late-blocks branch June 21, 2024 14:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants