Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions gossipd/gossip.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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));

Expand Down
4 changes: 2 additions & 2 deletions tests/test_closing.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ 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)
l1.daemon.wait_for_log("Forgetting remote peer .*")
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']
Expand Down
2 changes: 2 additions & 0 deletions tests/test_lightningd.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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
Expand Down