Skip to content

Commit

Permalink
pytest: Make test_pay_retry less flaky for liquid-regtest
Browse files Browse the repository at this point in the history
  • Loading branch information
cdecker committed Mar 6, 2020
1 parent 3e19781 commit 7bd62a4
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions tests/test_pay.py
Original file line number Diff line number Diff line change
Expand Up @@ -1557,14 +1557,17 @@ def test_pay_variants(node_factory):

@unittest.skipIf(not DEVELOPER, "gossip without DEVELOPER=1 is slow")
@unittest.skipIf(VALGRIND and SLOW_MACHINE, "Travis times out under valgrind")
def test_pay_retry(node_factory, bitcoind):
def test_pay_retry(node_factory, bitcoind, executor, chainparams):
"""Make sure pay command retries properly. """

def exhaust_channel(funder, fundee, scid, already_spent=0):
"""Spend all available capacity (10^6 - 1%) of channel"""
maxpay = (10**6 - 10**6 // 100 - 13440) * 1000 - already_spent
inv = fundee.rpc.invoice(maxpay,
''.join(random.choice(string.ascii_letters + string.digits) for _ in range(20)),
"exhaust_channel")
"""Spend all available capacity (10^6 - 1%) of channel
"""
peer = funder.rpc.listpeers(fundee.info['id'])['peers'][0]
chan = peer['channels'][0]
maxpay = chan['spendable_msatoshi']
lbl= ''.join(random.choice(string.ascii_letters) for _ in range(20))
inv = fundee.rpc.invoice(maxpay, lbl, "exhaust_channel")
routestep = {
'msatoshi': maxpay,
'id': fundee.info['id'],
Expand Down Expand Up @@ -1615,7 +1618,6 @@ def listpays_nofail(b11):

# Make sure listpays doesn't transiently show failure while pay
# is retrying.
executor = concurrent.futures.ThreadPoolExecutor()
fut = executor.submit(listpays_nofail, inv['bolt11'])

# Pay l1->l5 should succeed via straight line (eventually)
Expand Down

0 comments on commit 7bd62a4

Please sign in to comment.