Browse Source

pytest: Debug test_lockup_drain

ppa
Christian Decker 4 years ago
committed by neil saitug
parent
commit
f7cdf1dd98
  1. 7
      contrib/pyln-testing/pyln/testing/utils.py
  2. 1
      tests/test_pay.py

7
contrib/pyln-testing/pyln/testing/utils.py

@ -919,13 +919,16 @@ class LightningNode(object):
# This helper sends all money to a peer until even 1 msat can't get through. # This helper sends all money to a peer until even 1 msat can't get through.
def drain(self, peer): def drain(self, peer):
total = 0 total = 0
msat = 16**9 msat = 4294967295 # Max payment size in some configs
while msat != 0: while msat != 0:
try: try:
logging.debug("Drain step with size={}".format(msat))
self.pay(peer, msat) self.pay(peer, msat)
total += msat total += msat
except RpcError: except RpcError as e:
logging.debug("Got an exception while draining channel: {}".format(e))
msat //= 2 msat //= 2
logging.debug("Draining complete after sending a total of {}msats".format(total))
return total return total
# Note: this feeds through the smoother in update_feerate, so changing # Note: this feeds through the smoother in update_feerate, so changing

1
tests/test_pay.py

@ -2374,6 +2374,7 @@ def test_lockup_drain(node_factory, bitcoind):
# But if feerate increase just a little more, l2 should not be able to send # But if feerate increase just a little more, l2 should not be able to send
# non-fust HTLC to l1 # non-fust HTLC to l1
l1.force_feerates(30002) # TODO: Why does 30001 fail? off by one in C code? l1.force_feerates(30002) # TODO: Why does 30001 fail? off by one in C code?
wait_for(lambda: l1.rpc.listpeers()['peers'][0]['connected'])
with pytest.raises(RpcError, match=r".*Capacity exceeded.*"): with pytest.raises(RpcError, match=r".*Capacity exceeded.*"):
l2.pay(l1, total // 2) l2.pay(l1, total // 2)

Loading…
Cancel
Save