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>
This commit is contained in:
Rusty Russell 2019-02-17 21:51:35 +10:30 committed by Christian Decker
parent 41be796e0e
commit cb6a97152e
2 changed files with 4 additions and 0 deletions

View File

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

View File

@ -1374,6 +1374,9 @@ def test_pay_direct(node_factory, bitcoind):
# Let channels lock in. # Let channels lock in.
bitcoind.generate_block(5) 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. # Make sure l0 knows the l2->l3 channel.
# Without DEVELOPER, channel lockin can take 30 seconds to detect, # Without DEVELOPER, channel lockin can take 30 seconds to detect,
# and gossip 2 minutes to propagate # and gossip 2 minutes to propagate