mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-18 05:12:45 +01:00
pytest: Debug test_lockup_drain
This commit is contained in:
parent
1b8a2aba65
commit
f7cdf1dd98
@ -919,13 +919,16 @@ class LightningNode(object):
|
||||
# This helper sends all money to a peer until even 1 msat can't get through.
|
||||
def drain(self, peer):
|
||||
total = 0
|
||||
msat = 16**9
|
||||
msat = 4294967295 # Max payment size in some configs
|
||||
while msat != 0:
|
||||
try:
|
||||
logging.debug("Drain step with size={}".format(msat))
|
||||
self.pay(peer, msat)
|
||||
total += msat
|
||||
except RpcError:
|
||||
except RpcError as e:
|
||||
logging.debug("Got an exception while draining channel: {}".format(e))
|
||||
msat //= 2
|
||||
logging.debug("Draining complete after sending a total of {}msats".format(total))
|
||||
return total
|
||||
|
||||
# Note: this feeds through the smoother in update_feerate, so changing
|
||||
|
@ -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
|
||||
# non-fust HTLC to l1
|
||||
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.*"):
|
||||
l2.pay(l1, total // 2)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user