Browse Source

pytest: fix race in test_pay_direct.

I got a spurious failure because the final node gave a CLTV error and
so it decided to use a different channel.  It should probably handle
this corner case better, but meanwhile make the test robust.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
connected_hook
Rusty Russell 6 years ago
committed by Christian Decker
parent
commit
cb6a97152e
  1. 1
      lightningd/pay.c
  2. 3
      tests/test_pay.py

1
lightningd/pay.c

@ -328,6 +328,7 @@ remote_routing_failure(const tal_t *ctx,
if (failcode & PERM)
*pay_errcode = PAY_DESTINATION_PERM_FAIL;
else
/* FIXME: not right for WIRE_FINAL_EXPIRY_TOO_SOON */
*pay_errcode = PAY_TRY_OTHER_ROUTE;
erring_node = &route_nodes[origin_index];
} else {

3
tests/test_pay.py

@ -1374,6 +1374,9 @@ def test_pay_direct(node_factory, bitcoind):
# Let channels lock in.
bitcoind.generate_block(5)
# Make l1 sees it, so it doesn't produce bad CLTVs.
sync_blockheight(bitcoind, [l1])
# Make sure l0 knows the l2->l3 channel.
# Without DEVELOPER, channel lockin can take 30 seconds to detect,
# and gossip 2 minutes to propagate

Loading…
Cancel
Save