From 682e8e9663a17d2046611380a11e777910ed8c50 Mon Sep 17 00:00:00 2001 From: Christian Decker Date: Mon, 7 May 2018 15:57:20 +0200 Subject: [PATCH 1/4] pytest: Marking `test_permfail` as flaky Signed-off-by: Christian Decker --- tests/test_lightningd.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/test_lightningd.py b/tests/test_lightningd.py index 618d44899536..8f0f80f7a9e6 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() From 49f6774c0e2b5118523d1facb8c6cefc9ea2b551 Mon Sep 17 00:00:00 2001 From: Christian Decker Date: Mon, 7 May 2018 12:13:16 +0200 Subject: [PATCH 2/4] gossip: Clean up stale `store` argument to `handle_gossip_msg` This is a leftover from before splitting the `gossip_store` injection path from the handling of gossip messages. Signed-off-by: Christian Decker --- gossipd/gossip.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) 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)); From 16e8470ee8daf4a1f3e73d1117b45212771a03a8 Mon Sep 17 00:00:00 2001 From: Christian Decker Date: Tue, 8 May 2018 14:00:04 +0200 Subject: [PATCH 3/4] pytest: Use the port from the lightning node Signed-off-by: Christian Decker --- tests/test_closing.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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'] From b166c9a10d569b477c0cfce50cd4fca4c2a220f9 Mon Sep 17 00:00:00 2001 From: Christian Decker Date: Tue, 8 May 2018 16:00:27 +0200 Subject: [PATCH 4/4] pytest: Mark test_blockchaintrack as flaky The flakyness is probably due to timing issues when reorging. Signed-off-by: Christian Decker --- tests/test_lightningd.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/test_lightningd.py b/tests/test_lightningd.py index 8f0f80f7a9e6..735f701a01db 100644 --- a/tests/test_lightningd.py +++ b/tests/test_lightningd.py @@ -4471,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