diff --git a/gossipd/gossip.c b/gossipd/gossip.c index 4afa2fda38ab..090e9f19670b 100644 --- a/gossipd/gossip.c +++ b/gossipd/gossip.c @@ -612,8 +612,14 @@ static void send_node_announcement(struct daemon *daemon) tal_hex(tmpctx, err)); } -/* Returns error if we should send an error. */ -static u8 *handle_gossip_msg(struct daemon *daemon, const u8 *msg, bool store) +/** + * Handle an incoming gossip message + * + * Returns wire formatted error if handling failed. The error contains the + * details of the failures. The caller is expected to return the error to the + * peer, or drop the error if the message did not come from a peer. + */ +static u8 *handle_gossip_msg(struct daemon *daemon, const u8 *msg) { struct routing_state *rstate = daemon->rstate; int t = fromwire_peektype(msg); @@ -743,7 +749,7 @@ static struct io_plan *peer_msgin(struct io_conn *conn, case WIRE_CHANNEL_ANNOUNCEMENT: case WIRE_NODE_ANNOUNCEMENT: case WIRE_CHANNEL_UPDATE: - err = handle_gossip_msg(peer->daemon, msg, true); + err = handle_gossip_msg(peer->daemon, msg); if (err) queue_peer_msg(peer, take(err)); return peer_next_in(conn, peer); @@ -926,7 +932,7 @@ static struct io_plan *owner_msg_in(struct io_conn *conn, int type = fromwire_peektype(msg); if (type == WIRE_CHANNEL_ANNOUNCEMENT || type == WIRE_CHANNEL_UPDATE || type == WIRE_NODE_ANNOUNCEMENT) { - err = handle_gossip_msg(peer->daemon, dc->msg_in, true); + err = handle_gossip_msg(peer->daemon, dc->msg_in); if (err) queue_peer_msg(peer, take(err)); diff --git a/tests/test_closing.py b/tests/test_closing.py index d7b8b1c9728c..29823690f0ce 100644 --- a/tests/test_closing.py +++ b/tests/test_closing.py @@ -12,7 +12,7 @@ def test_closing_id(node_factory): l1, l2 = node_factory.get_nodes(2) # Close by full channel ID. - l1.rpc.connect(l2.info['id'], 'localhost', l2.info['port']) + l1.rpc.connect(l2.info['id'], 'localhost', l2.port) l1.fund_channel(l2, 10**6) cid = l2.rpc.listpeers()['peers'][0]['channels'][0]['channel_id'] l2.rpc.close(cid) @@ -20,7 +20,7 @@ def test_closing_id(node_factory): l2.daemon.wait_for_log("Forgetting remote peer .*") # Close by peer ID. - l2.rpc.connect(l1.info['id'], 'localhost', l1.info['port']) + l2.rpc.connect(l1.info['id'], 'localhost', l1.port) l1.daemon.wait_for_log("hand_back_peer .*: now local again") l2.fund_channel(l1, 10**6) pid = l1.info['id'] diff --git a/tests/test_lightningd.py b/tests/test_lightningd.py index 618d44899536..735f701a01db 100644 --- a/tests/test_lightningd.py +++ b/tests/test_lightningd.py @@ -1490,6 +1490,7 @@ def test_closing_different_fees(self): wait_for(lambda: p.rpc.listpeers(l1.info['id'])['peers'][0]['channels'][0]['status'][1] == 'ONCHAIN:Tracking mutual close transaction') l1.daemon.wait_for_logs([' to ONCHAIN'] * num_peers) + @flaky @unittest.skipIf(not DEVELOPER, "needs DEVELOPER=1") def test_permfail(self): l1, l2 = self.connect() @@ -4470,6 +4471,7 @@ def test_peerinfo(self): assert l1.rpc.listnodes()['nodes'] == [] assert l2.rpc.listnodes()['nodes'] == [] + @flaky @unittest.skipIf(not DEVELOPER, "needs DEVELOPER=1") def test_blockchaintrack(self): """Check that we track the blockchain correctly across reorgs