mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 15:14:23 +01:00
pytest: Stabilize the test_pay_direct test
It was waiting for a remote channel, but not for all the interesting channels we want to check. It can sometimes happen that further away channels are added before closer ones are added, depending on propagation path, flush timers and bitcoind poll timers. This now just checks for all channels, which also reduces the ambiguity of whether we selected a path solely because we were lacking alternatives. Signed-off-by: Christian Decker <decker.christian@gmail.com>
This commit is contained in:
committed by
Rusty Russell
parent
960664337f
commit
b7222531fe
@@ -606,12 +606,25 @@ class LightningNode(object):
|
||||
|
||||
# This waits until gossipd sees channel_update in both directions
|
||||
# (or for local channels, at least a local announcement)
|
||||
def wait_for_routes(self, channel_ids):
|
||||
def wait_for_channel_updates(self, scids):
|
||||
# Could happen in any order...
|
||||
self.daemon.wait_for_logs(['Received channel_update for channel {}/0'.format(c)
|
||||
for c in channel_ids]
|
||||
for c in scids]
|
||||
+ ['Received channel_update for channel {}/1'.format(c)
|
||||
for c in channel_ids])
|
||||
for c in scids])
|
||||
|
||||
def wait_for_route(self, destination, timeout=30):
|
||||
""" Wait for a route to the destination to become available.
|
||||
"""
|
||||
start_time = time.time()
|
||||
while time.time() < start_time + timeout:
|
||||
try:
|
||||
self.rpc.getroute(destination.info['id'], 1, 1)
|
||||
return True
|
||||
except Exception:
|
||||
time.sleep(1)
|
||||
if time.time() > start_time + timeout:
|
||||
raise ValueError("Error waiting for a route to destination {}".format(destination))
|
||||
|
||||
def pay(self, dst, amt, label=None):
|
||||
if not label:
|
||||
|
||||
Reference in New Issue
Block a user