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

Retransmit NodeAnnouncement on regular intervals #2084

Merged
merged 8 commits into from Sep 17, 2019

Conversation

@halseth
Copy link
Collaborator

commented Oct 23, 2018

This PR makes the gossiper retransmit our NodeAnnouncement every 24 hrs, to avoid other nodes considering it being a zombie. This is similar to what is done for channels.

Fixes #2005.

@Roasbeef Roasbeef requested a review from wpaulino Oct 24, 2018
Copy link
Collaborator

left a comment

Nice commit structure!

discovery/gossiper.go Outdated Show resolved Hide resolved
discovery/gossiper_test.go Outdated Show resolved Hide resolved
discovery/gossiper_test.go Outdated Show resolved Hide resolved
discovery/gossiper_test.go Outdated Show resolved Hide resolved
discovery/gossiper_test.go Outdated Show resolved Hide resolved
discovery/gossiper.go Outdated Show resolved Hide resolved
server.go Outdated
ProofMatureDelta: 0,
TrickleDelay: time.Millisecond * time.Duration(cfg.TrickleDelay),
RetransmitDelay: time.Minute * 30,
RebroadcastInterval: time.Hour * 24,

This comment has been minimized.

Copy link
@wpaulino

wpaulino Oct 27, 2018

Collaborator

Any reason this is the default? It could be made less spammy IMO.

This comment has been minimized.

Copy link
@halseth

halseth Oct 29, 2018

Author Collaborator

Could reasonably be made longer, but don't think one update every 24 hrs is the biggest spam problem atm.

This comment has been minimized.

Copy link
@wpaulino

wpaulino Sep 10, 2019

Collaborator

Sure but given that we only consider things stale after 2 weeks it could be set a bit higher.

@halseth halseth force-pushed the halseth:node-announcement-stale branch 3 times, most recently from 8821aad to 89edb0d Oct 30, 2018
@halseth halseth force-pushed the halseth:node-announcement-stale branch 2 times, most recently from f8ab1a7 to ce72601 Nov 9, 2018
@wpaulino

This comment has been minimized.

Copy link
Collaborator

commented Sep 3, 2019

Needs a rebase!

@wpaulino wpaulino added the v0.8.0 label Sep 3, 2019
@wpaulino wpaulino added this to the 0.8.0 milestone Sep 3, 2019
@halseth halseth force-pushed the halseth:node-announcement-stale branch from ce72601 to 16d4bac Sep 4, 2019
@halseth halseth requested review from cfromknecht and Roasbeef as code owners Sep 4, 2019
@halseth halseth force-pushed the halseth:node-announcement-stale branch from 16d4bac to 5085beb Sep 4, 2019
@halseth

This comment has been minimized.

Copy link
Collaborator Author

commented Sep 4, 2019

Rebased.

@halseth halseth requested a review from wpaulino Sep 4, 2019
discovery/gossiper_test.go Outdated Show resolved Hide resolved
discovery/gossiper.go Outdated Show resolved Hide resolved
discovery/gossiper_test.go Outdated Show resolved Hide resolved
discovery/gossiper_test.go Outdated Show resolved Hide resolved
@wpaulino wpaulino removed the request for review from Roasbeef Sep 4, 2019
discovery/gossiper.go Show resolved Hide resolved
discovery/gossiper_test.go Show resolved Hide resolved
discovery/gossiper_test.go Outdated Show resolved Hide resolved
discovery/gossiper.go Outdated Show resolved Hide resolved
err)
}

timestamp := time.Unix(int64(currentNodeAnn.Timestamp), 0)

This comment has been minimized.

Copy link
@wpaulino

wpaulino Sep 4, 2019

Collaborator

Just something to note, the timestamp of our node announcement is updated to time.Now every time the server is started.

This comment has been minimized.

Copy link
@wpaulino

wpaulino Sep 10, 2019

Collaborator

Because of this, if a node restarts before it reaches a full day of uptime, it'll never rebroadcast its node announcement.

This comment has been minimized.

Copy link
@halseth

halseth Sep 12, 2019

Author Collaborator

I think that's good enough for now. I think maybe there was an issue/PR already for transmitting the node announcement if it changes?

This comment has been minimized.

Copy link
@halseth

halseth Sep 12, 2019

Author Collaborator

Relevant:
#1120
#325
#274

This comment has been minimized.

Copy link
@halseth

halseth Sep 12, 2019

Author Collaborator

Won't the announcement be rebroadcast when the time us updated at startup? From that issue it seems so.

This comment has been minimized.

Copy link
@wpaulino

wpaulino Sep 14, 2019

Collaborator

I don't think that's the case. We only seem to send when opening a channel or when running with --nat.

discovery/gossiper_test.go Outdated Show resolved Hide resolved
@halseth halseth force-pushed the halseth:node-announcement-stale branch 4 times, most recently from 506d249 to 4dc3b2c Sep 10, 2019
@halseth halseth requested review from cfromknecht and wpaulino Sep 10, 2019
discovery/gossiper.go Outdated Show resolved Hide resolved
err)
}

timestamp := time.Unix(int64(currentNodeAnn.Timestamp), 0)

This comment has been minimized.

Copy link
@wpaulino

wpaulino Sep 10, 2019

Collaborator

Because of this, if a node restarts before it reaches a full day of uptime, it'll never rebroadcast its node announcement.

discovery/gossiper_test.go Outdated Show resolved Hide resolved
@halseth halseth force-pushed the halseth:node-announcement-stale branch from 4dc3b2c to ec91c34 Sep 11, 2019
halseth added 8 commits Sep 10, 2019
Also let retransmitStaleChannels take a timestamp, to make it easier to
test.
This commit adds a test that ensures outdated announcements are
retransmitted when the RetransmitTicker ticks.
@halseth halseth force-pushed the halseth:node-announcement-stale branch from ec91c34 to 92123c6 Sep 16, 2019
Copy link
Collaborator

left a comment

LGTM 🔥

Copy link
Collaborator

left a comment

LGTM, though I still think the node announcement timestamp issue should be addressed in order to be consistent, likely as a separate PR.

@halseth

This comment has been minimized.

Copy link
Collaborator Author

commented Sep 17, 2019

LGTM, though I still think the node announcement timestamp issue should be addressed in order to be consistent, likely as a separate PR.

I updated and reopened #274. Let me know if this is what you had in mind.

@wpaulino

This comment has been minimized.

Copy link
Collaborator

commented Sep 17, 2019

I updated and reopened #274. Let me know if this is what you had in mind.

SGTM

@wpaulino wpaulino merged commit 9e4c4c5 into lightningnetwork:master Sep 17, 2019
2 checks passed
2 checks passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
coverage/coveralls Coverage increased (+0.03%) to 61.553%
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.