Skip to content

Commit

Permalink
openingd: fix hangup when gossipd compacts.
Browse files Browse the repository at this point in the history
My raspberry pi node hung up on my other node:
   lightning_openingd-... chan #1: Got bad message from gossipd: 0db1

This is because we didn't handle that message in one path.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
  • Loading branch information
rustyrussell committed May 15, 2019
1 parent d054fef commit c2a5f8d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
5 changes: 5 additions & 0 deletions openingd/openingd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1348,6 +1348,11 @@ static void handle_gossip_in(struct state *state)
status_failed(STATUS_FAIL_GOSSIP_IO,
"Reading gossip: %s", strerror(errno));

if (fromwire_gossipd_new_store_fd(msg)) {
tal_free(msg);
new_gossip_store(GOSSIP_STORE_FD, fdpass_recv(GOSSIP_FD));
return;
}
handle_gossip_msg(PEER_FD, GOSSIP_STORE_FD, &state->cs, take(msg));
}

Expand Down
15 changes: 15 additions & 0 deletions tests/test_gossip.py
Original file line number Diff line number Diff line change
Expand Up @@ -1080,3 +1080,18 @@ def test_gossip_store_private_channels(node_factory, bitcoind):
# We should still see local channels!
chans = l1.rpc.listchannels()['channels']
assert len(chans) == 2


@unittest.skipIf(not DEVELOPER, "need dev-compact-gossip-store")
def test_gossip_store_compact(node_factory, bitcoind):
l1, l2, l3 = node_factory.line_graph(3, fundchannel=False)

# Create channel.
l2.fund_channel(l3, 10**6)

# Now compact store.
l2.rpc.call('dev-compact-gossip-store')

# Should still be connected.
time.sleep(1)
assert len(l2.rpc.listpeers()['peers']) == 2

0 comments on commit c2a5f8d

Please sign in to comment.