test_lightningd.py: fix obscure corner case in gossip.

I actually hit this very hard to reproduce race: if we haven't process
the channeld message when block #6 comes in, we won't send the gossip
message.  We wait for logs, but don't generate new blocks, and timeout
on l1.daemon.wait_for_log('peer_out WIRE_ANNOUNCEMENT_SIGNATURES').

The solution, which also tests that we don't send announcement signatures
immediately, is to generate a single block, wait for CHANNELD_NORMAL,
then (in gossip tests), generate 5 more.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2017-06-06 09:17:10 +09:30
parent 605438f213
commit 87fc3439c4
3 changed files with 21 additions and 4 deletions

View File

@@ -612,16 +612,19 @@ static struct io_plan *resolve_channel_req(struct io_conn *conn,
status_failed(WIRE_GOSSIPSTATUS_BAD_REQUEST,
"Unable to parse resolver request");
status_trace("Attempting to resolve channel %s",
type_to_string(trc, struct short_channel_id, &scid));
nc = get_connection_by_scid(daemon->rstate, &scid, 0);
if (!nc) {
status_trace("Failed to resolve channel %s",
type_to_string(trc, struct short_channel_id, &scid));
keys = NULL;
} else {
keys = tal_arr(msg, struct pubkey, 2);
keys[0] = nc->src->id;
keys[1] = nc->dst->id;
status_trace("Resolved channel %s %s<->%s",
type_to_string(trc, struct short_channel_id, &scid),
type_to_string(trc, struct pubkey, &keys[0]),
type_to_string(trc, struct pubkey, &keys[1]));
}
daemon_conn_send(&daemon->master,
take(towire_gossip_resolve_channel_reply(msg, keys)));

View File

@@ -662,6 +662,10 @@ static enum watch_result funding_announce_cb(struct peer *peer,
return KEEP_WATCHING;
}
if (peer->state != CHANNELD_NORMAL || !peer->owner) {
log_debug(peer->ld->log,
"Funding tx announce ready, but peer state %s %s",
peer_state_name(peer->state),
peer->owner ? peer->owner->name : "unowned");
return KEEP_WATCHING;
}
subd_send_msg(peer->owner,