Skip to content

Disable channel when losing the underlying connection#756

Merged
rustyrussell merged 9 commits intoElementsProject:masterfrom
cdecker:disable-on-shutdown
Jan 26, 2018
Merged

Disable channel when losing the underlying connection#756
rustyrussell merged 9 commits intoElementsProject:masterfrom
cdecker:disable-on-shutdown

Conversation

@cdecker
Copy link
Member

@cdecker cdecker commented Jan 24, 2018

We were not updating our own local view of the network, nor were we sending out disabling channel_updates in case we lose connection. This PR fixes that.

Fixes #751
Fixes #635
Fixes #682

Sends a disable channel_update before issuing the shutdown message,
gossipd will also take care to update others and not use for future
routes.

Signed-off-by: Christian Decker <decker.christian@gmail.com>
Disabling the channel and enqueing the update for broadcast so we
don't get forwarding requests from remote peers, and we don't try to
ourselves.

Signed-off-by: Christian Decker <decker.christian@gmail.com>
Signed-off-by: Christian Decker <decker.christian@gmail.com>
Signed-off-by: Christian Decker <decker.christian@gmail.com>
@cdecker cdecker added this to the v0.6 milestone Jan 24, 2018
@cdecker cdecker requested a review from rustyrussell January 24, 2018 15:03
Signed-off-by: Christian Decker <decker.christian@gmail.com>
Signed-off-by: Christian Decker <decker.christian@gmail.com>
Signed-off-by: Christian Decker <decker.christian@gmail.com>
We are now too quick in disabling the channel for us to attempt a
payment. We need to separate into getroute and sendpay to trigger this
now.

Signed-off-by: Christian Decker <decker.christian@gmail.com>
@cdecker cdecker force-pushed the disable-on-shutdown branch from 850859a to 25bcaeb Compare January 24, 2018 15:04
@cdecker cdecker requested a review from jb55 January 24, 2018 15:04
Copy link
Contributor

@rustyrussell rustyrussell left a comment

Choose a reason for hiding this comment

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

Minor q...

if (peer->ld->config.ignore_fee_limits)
log_debug(peer->log, "Ignoring fee limits!");

peer->direction = pubkey_cmp(&peer->ld->id, &peer->id) > 0;
Copy link
Contributor

Choose a reason for hiding this comment

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

Hoist the channel_direction() macro out of gossipd perhaps?

Copy link
Member Author

Choose a reason for hiding this comment

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

It's in routing.h, so just including that should suffice.

"disable",
type_to_string(msg, struct short_channel_id, &scid),
direction);
goto fail;
Copy link
Contributor

Choose a reason for hiding this comment

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

In this case, what if active was true? Did we just enable a channel w/o a channel update?

I think this test should be moved up above the assignment?

Copy link
Member Author

Choose a reason for hiding this comment

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

Can't do that, otherwise we can only ever deactivate a channel that has reached announce_depth, i.e., 6 blocks. The channel is activated locally after funding_depth, i.e., 2 confirmations. So if we happen to lose the connection or similar, which the channel has 2-5 confirmations we cannot deactivate and we're stuck with a non-functioning channel being returned as part of the routes.

If the channel is public, we also have a channel_update which we can update with the disable flag, if the channel is not public, then others don't care anyway.

Copy link
Contributor

Choose a reason for hiding this comment

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

Good point.

OK, my q still stands. We're asserting that active == false in this branch (based on the msg), we should actually assert that?

I'll apply this now, but please consider...

@cdecker cdecker mentioned this pull request Jan 25, 2018
@jb55 jb55 mentioned this pull request Jan 25, 2018
6 tasks
@cdecker cdecker dismissed rustyrussell’s stale review January 25, 2018 18:23

Can't push the deactivation further down, addressed the macro inclusion.

@rustyrussell rustyrussell merged commit 6cfc0a6 into ElementsProject:master Jan 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

First peer not ready getroute includes route with a peer even though channel with peer is CLOSINGD_COMPLETE Route around unusable 0-hop channels?

2 participants