pytest: speed up test_restart_many_payments when !DEVELOPER.

Because gossip in this case takes up to a minute, this test took 10
minutes.  The workaround is to do the waiting-for-gossip all at once.

Now it takes 362 seconds.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2018-11-22 12:47:29 +10:30
parent d9d762170a
commit 1d7b287439
2 changed files with 42 additions and 15 deletions

View File

@@ -493,7 +493,7 @@ class LightningNode(object):
self.start()
def fund_channel(self, l2, amount):
def fund_channel(self, l2, amount, wait_for_active=True):
# Give yourself some funds to work with
addr = self.rpc.newaddr()['address']
@@ -524,18 +524,19 @@ class LightningNode(object):
decoded2 = self.bitcoin.rpc.decoderawtransaction(tx)
raise ValueError("Can't find {} payment in {} (1={} 2={})".format(amount, tx, decoded, decoded2))
# We wait until gossipd sees both local updates, as well as status NORMAL,
# so it can definitely route through.
self.daemon.wait_for_logs([r'update for channel {}\(0\) now ACTIVE'
.format(scid),
r'update for channel {}\(1\) now ACTIVE'
.format(scid),
'to CHANNELD_NORMAL'])
l2.daemon.wait_for_logs([r'update for channel {}\(0\) now ACTIVE'
.format(scid),
r'update for channel {}\(1\) now ACTIVE'
.format(scid),
'to CHANNELD_NORMAL'])
if wait_for_active:
# We wait until gossipd sees both local updates, as well as status NORMAL,
# so it can definitely route through.
self.daemon.wait_for_logs([r'update for channel {}\(0\) now ACTIVE'
.format(scid),
r'update for channel {}\(1\) now ACTIVE'
.format(scid),
'to CHANNELD_NORMAL'])
l2.daemon.wait_for_logs([r'update for channel {}\(0\) now ACTIVE'
.format(scid),
r'update for channel {}\(1\) now ACTIVE'
.format(scid),
'to CHANNELD_NORMAL'])
return scid
def subd_pid(self, subd):