Skip to content

Gossip improvements - #430

Closed
rustyrussell wants to merge 16 commits into
ElementsProject:masterfrom
rustyrussell:gossip-improvements
Closed

rustyrussell wants to merge 16 commits into
ElementsProject:masterfrom
rustyrussell:gossip-improvements

Conversation

@rustyrussell

Copy link
Copy Markdown
Collaborator

c.f. #413

Christian, I'll let you merge the two; there's good in both, IMHO.

Rather than using the destructor, hook up the cmd so we can close it.
peers are allocated off ld, so they are only destroyed explicitly.

Signed-off-by: Rusty Russell <[email protected]>
As demonstrated in the test at the end of this series, openingd dying
spontaneously causes the conn to be freed which causes the subd to be
destroyed, which fails the peer, which hits the db.

Signed-off-by: Rusty Russell <[email protected]>
On unmarshal, we stop unmarshaling on a 0 (ADDR_TYPE_PADDING) type.  So
we should also stop marshaling in that case.

Signed-off-by: Rusty Russell <[email protected]>
We can open other channels, if we want.

Signed-off-by: Rusty Russell <[email protected]>
We should not disconnect from a peer just because it fails opening; we
should return it to gossipd, and give a meaningful error.

Closes: ElementsProject#401
Signed-off-by: Rusty Russell <[email protected]>
We'll want this for the next change, where gossipd migrates remote peers
back to local ones.

Signed-off-by: Rusty Russell <[email protected]>
…elds.

We should also go through and use consistent nomenclature on functions which
are used with a local peer ("lpeer_xxx"?) and those with a remote peer
("rpeer_xxx"?) but this is minimal.

Signed-off-by: Rusty Russell <[email protected]>
Otherwise we always say it died because we killed it, so we don't get
the exit status.

Signed-off-by: Rusty Russell <[email protected]>
Rather than routing via master, we send to channeld.  It then creates
node announcement.

Closes: ElementsProject#320
Signed-off-by: Rusty Russell <[email protected]>
All peers come from gossipd, and maintain an fd to talk to it.  Sometimes
we hand the peer back, but to avoid a race, we always recreated it.

The race was that a daemon closed the gossip_fd, which made gossipd
forget the peer, then master handed the peer back to gossipd.  We stop
the race by never closing the gossipfd, but hand it back to gossipd
for closing.

Now gossipd has to accept two fds, but the handling of peers is far
clearer.

Signed-off-by: Rusty Russell <[email protected]>
If the peer is moved from remote to local, this may be lost; it's more
secure to increment after we've sent the broadcast.
@rustyrussell
rustyrussell requested a review from cdecker December 11, 2017 03:19
When gossipd sends a message, have a gossip_index.  When it gets back a
peer, the current gossip_index is included, so it can know exactly where
it's up to.

Most of this is mechanical plumbing through openingd, channeld and closingd,
even though openingd and closingd don't (currently) read gossip, so their
gossip_index will be unchanged.

Signed-off-by: Rusty Russell <[email protected]>
@cdecker

cdecker commented Dec 11, 2017

Copy link
Copy Markdown
Member

Seems we don't overlap too much, except for two commits, I'll try to disentangle the two :-)

@cdecker

cdecker commented Dec 15, 2017

Copy link
Copy Markdown
Member

Closing in favor of #413, all non-conflicting changes have been cherry-picked.

@cdecker cdecker closed this Dec 15, 2017
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