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

discovery/sync_manager: restart historical sync on first connected peer #3103

Merged

Conversation

Projects
None yet
3 participants
@halseth
Copy link
Collaborator

commented May 21, 2019

To handle the case where we have been without peers, and get a new
connection, we reset the historical scan booleans when the first active
syncer is connected to trigger another historical sync.

This would cause integration tests to be flaky (especially with Neutrino), since we would risk not getting graph updates after having being disconnected.

@halseth halseth requested a review from wpaulino May 21, 2019

@halseth halseth referenced this pull request May 21, 2019

Merged

Neutrino integration tests #1881

8 of 8 tasks complete
@wpaulino
Copy link
Collaborator

left a comment

An alternative approach would be to modify the historical sync interval in the integration tests, though I think this is still useful given the following scenario: if you've lost all your peers and start receiving new updates at tip, you won't be able to process some of these channels if you've yet to see their channel announcement, so performing a historical sync before doing so would make sense.

LGTM 📦

case !initialHistoricalSyncCompleted:
s.setSyncType(PassiveSync)
m.inactiveSyncers[s.cfg.peerPub] = s

// Otherwise, it should be initialized as active.

This comment has been minimized.

Copy link
@wpaulino

wpaulino May 21, 2019

Collaborator

Nit: seems like a redundant comment.

This comment has been minimized.

Copy link
@halseth

halseth May 24, 2019

Author Collaborator

Removed: 9c9ac36

// TestSyncManagerHistoricalSyncOnReconnect tests that the sync manager will
// re-trigger a historical sync when a new peer connects after a historical
// sync has completed, but we have lost all peers.
func TestSyncManagerHistoricalSyncOnReconnect(t *testing.T) {

This comment has been minimized.

Copy link
@wpaulino

wpaulino May 21, 2019

Collaborator

Nit: would prefer if this commit was squashed with what introduced the behavior.

This comment has been minimized.

Copy link
@halseth

halseth May 24, 2019

Author Collaborator

I prefer splitting a bugfix and the test reproducing the bug in separate commits. Especially when I'm reviewing this makes it easy to cherry-pick the test commit on master to exercise the failing scenario.

This comment has been minimized.

Copy link
@wpaulino

wpaulino May 24, 2019

Collaborator

Sure but that wasn't the case here. The non-test changes alone didn't have an impact on the tests 😛

@cfromknecht
Copy link
Collaborator

left a comment

LGTM after squash!

@halseth halseth force-pushed the halseth:syncmanager-resync-historical branch from 538b403 to 9c9ac36 May 24, 2019

halseth added some commits May 21, 2019

discovery/sync_manager: restart historical sync on first connected peer
To handle the case where we have been without peers, and get a new
connection, we reset the historical scan booleans when the first active
syncer is connected to trigger another historical sync.
discovery/sync_manager_test: add TestSyncManagerHistoricalSyncOnRecon…
…nect

TestSyncManagerHistoricalSyncOnReconnect tests that the sync manager will
re-trigger a historical sync when a new peer connects after a historical
sync has completed, but we have lost all peers.

@halseth halseth force-pushed the halseth:syncmanager-resync-historical branch from 9c9ac36 to 6ba6982 May 24, 2019

@halseth halseth merged commit af3b04e into lightningnetwork:master May 24, 2019

1 of 2 checks passed

coverage/coveralls Coverage decreased (-0.006%) to 60.323%
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.