test_lightning: fix race on testing, esp. test_closing_different_fees.

We get intermittant failure: WIRE_UNKNOWN_NEXT_PEER (First peer not ready)
because CHANNELD_NORMAL and actually telling gossipd that the channel
is available are distinct things: we need both.

(For test_closing_different_fees, we were testing CHANNELD_NORMAL on
the peer, not on l1, too).

But we may also directly send the announcement sigs if the height is
sufficient, so the simplest is to unify the messages.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2018-02-07 11:28:36 +10:30 committed by Christian Decker
parent 203c222f57
commit d5effcb961
3 changed files with 11 additions and 6 deletions

View file

@ -809,7 +809,8 @@ static void handle_local_add_channel(struct peer *peer, u8 *msg)
c->htlc_minimum_msat = htlc_minimum_msat; c->htlc_minimum_msat = htlc_minimum_msat;
c->base_fee = fee_base_msat; c->base_fee = fee_base_msat;
c->proportional_fee = fee_proportional_millionths; c->proportional_fee = fee_proportional_millionths;
status_trace("Channel %s(%d) was updated (LOCAL)", /* Designed to match msg in handle_channel_update, for easy testing */
status_trace("Received local update for channel %s(%d) now ACTIVE",
type_to_string(msg, struct short_channel_id, &scid), type_to_string(msg, struct short_channel_id, &scid),
direction); direction);
} }

View file

@ -931,10 +931,11 @@ void handle_channel_update(struct routing_state *rstate, const u8 *update)
return; return;
} }
status_trace("Received channel_update for channel %s(%d)", status_trace("Received channel_update for channel %s(%d) now %s",
type_to_string(trc, struct short_channel_id, type_to_string(trc, struct short_channel_id,
&short_channel_id), &short_channel_id),
flags & 0x01); flags & 0x01,
flags & ROUTING_FLAGS_DISABLED ? "DISABLED" : "ACTIVE");
c->last_timestamp = timestamp; c->last_timestamp = timestamp;
c->delay = expiry; c->delay = expiry;

View file

@ -264,8 +264,10 @@ class LightningDTests(BaseLightningDTests):
# Technically, this is async to fundchannel. # Technically, this is async to fundchannel.
l1.daemon.wait_for_log('sendrawtx exit 0') l1.daemon.wait_for_log('sendrawtx exit 0')
l1.bitcoin.generate_block(1) l1.bitcoin.generate_block(1)
l1.daemon.wait_for_log(' to CHANNELD_NORMAL') # We wait until gossipd sees local update, as well as status NORMAL,
l2.daemon.wait_for_log(' to CHANNELD_NORMAL') # so it can definitely route through.
l1.daemon.wait_for_logs(['update for channel .* now ACTIVE', 'to CHANNELD_NORMAL'])
l2.daemon.wait_for_logs(['update for channel .* now ACTIVE', 'to CHANNELD_NORMAL'])
# Hacky way to find our output. # Hacky way to find our output.
decoded=bitcoind.rpc.decoderawtransaction(tx) decoded=bitcoind.rpc.decoderawtransaction(tx)
@ -1036,8 +1038,9 @@ class LightningDTests(BaseLightningDTests):
bitcoind.generate_block(6) bitcoind.generate_block(6)
# Now wait for them all to hit normal state, do payments # Now wait for them all to hit normal state, do payments
l1.daemon.wait_for_logs(['update for channel .* now ACTIVE'] * num_peers
+ ['to CHANNELD_NORMAL'] * num_peers)
for p in peers: for p in peers:
p.daemon.wait_for_log('to CHANNELD_NORMAL')
if p.amount != 0: if p.amount != 0:
self.pay(l1,p,100000000) self.pay(l1,p,100000000)