Browse Source

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>
ppa-0.6.1
Rusty Russell 7 years ago
committed by Christian Decker
parent
commit
d5effcb961
  1. 3
      gossipd/gossip.c
  2. 5
      gossipd/routing.c
  3. 9
      tests/test_lightningd.py

3
gossipd/gossip.c

@ -809,7 +809,8 @@ static void handle_local_add_channel(struct peer *peer, u8 *msg)
c->htlc_minimum_msat = htlc_minimum_msat;
c->base_fee = fee_base_msat;
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),
direction);
}

5
gossipd/routing.c

@ -931,10 +931,11 @@ void handle_channel_update(struct routing_state *rstate, const u8 *update)
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,
&short_channel_id),
flags & 0x01);
flags & 0x01,
flags & ROUTING_FLAGS_DISABLED ? "DISABLED" : "ACTIVE");
c->last_timestamp = timestamp;
c->delay = expiry;

9
tests/test_lightningd.py

@ -264,8 +264,10 @@ class LightningDTests(BaseLightningDTests):
# Technically, this is async to fundchannel.
l1.daemon.wait_for_log('sendrawtx exit 0')
l1.bitcoin.generate_block(1)
l1.daemon.wait_for_log(' to CHANNELD_NORMAL')
l2.daemon.wait_for_log(' to CHANNELD_NORMAL')
# We wait until gossipd sees local update, as well as status 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.
decoded=bitcoind.rpc.decoderawtransaction(tx)
@ -1036,8 +1038,9 @@ class LightningDTests(BaseLightningDTests):
bitcoind.generate_block(6)
# 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:
p.daemon.wait_for_log('to CHANNELD_NORMAL')
if p.amount != 0:
self.pay(l1,p,100000000)

Loading…
Cancel
Save