mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-20 15:44:21 +01:00
gossipd: have master explicitly tell us when peer is disconnected.
Currently we intuit it from the fd being closed, but that may happen out of order with when the master thinks it's dead. So now if the gossip fd closes we just ignore it, and we'll get a notification from the master when the peer is disconnected. The notification is slightly ugly in that we have to disable it for a channel when we manually hand the channel back to gossipd. Note: as stands, this is racy with reconnects. See the next patch. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -237,7 +237,9 @@ wallet_commit_channel(struct lightningd *ld,
|
||||
final_key_idx, false,
|
||||
NULL, /* No commit sent yet */
|
||||
uc->first_blocknum,
|
||||
feerate, feerate);
|
||||
feerate, feerate,
|
||||
/* We are connected */
|
||||
true);
|
||||
|
||||
/* Now we finally put it in the database. */
|
||||
wallet_channel_insert(ld->wallet, channel);
|
||||
@@ -546,7 +548,9 @@ static void opening_channel_errmsg(struct uncommitted_channel *uc,
|
||||
const u8 *err_for_them)
|
||||
{
|
||||
if (peer_fd == -1) {
|
||||
u8 *msg = towire_gossipctl_peer_disconnected(tmpctx, &uc->peer->id);
|
||||
log_info(uc->log, "%s", desc);
|
||||
subd_send_msg(uc->peer->ld->gossip, msg);
|
||||
if (uc->fc)
|
||||
command_fail(uc->fc->cmd, "%s", desc);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user