Skip to content

Commit

Permalink
test_lightning: fix race on testing, esp. test_closing_different_fees.
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
rustyrussell authored and cdecker committed Feb 9, 2018
1 parent 203c222 commit d5effcb
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
3 changes: 2 additions & 1 deletion gossipd/gossip.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
5 changes: 3 additions & 2 deletions gossipd/routing.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
9 changes: 6 additions & 3 deletions tests/test_lightningd.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,8 +264,10 @@ def fund_channel(self, l1, l2, amount):
# 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)
Expand Down Expand Up @@ -1036,8 +1038,9 @@ def test_closing_different_fees(self):
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)

Expand Down

0 comments on commit d5effcb

Please sign in to comment.