Skip to content

Commit

Permalink
repro: Reproduce a crash due to a fee-disagreement
Browse files Browse the repository at this point in the history
  • Loading branch information
cdecker committed Feb 12, 2024
1 parent 48c6551 commit 79aa46f
Showing 1 changed file with 19 additions and 14 deletions.
33 changes: 19 additions & 14 deletions tests/test_pay.py
Original file line number Diff line number Diff line change
Expand Up @@ -764,22 +764,27 @@ def test_sendpay_cant_afford(node_factory, anchors):
with pytest.raises(RpcError):
l1.pay(l2, 10**9 + 1)

from pprint import pprint
pprint(l1.rpc.listpeerchannels())

# Reserve is 1%.
reserve = 10**7

# # This is how we recalc constants (v. v. slow!)
# minimum = 1
# maximum = 10**9
# while maximum - minimum > 1:
# l1, l2 = node_factory.line_graph(2, fundamount=10**6,
# opts={'feerates': (15000, 15000, 15000, 15000)})
# try:
# l1.pay(l2, (minimum + maximum) // 2)
# minimum = (minimum + maximum) // 2
# except RpcError:
# maximum = (minimum + maximum) // 2
# print("{} - {}".format(minimum, maximum))
# assert False
# This is how we recalc constants (v. v. slow!)
minimum = 1
maximum = 10**9

while maximum - minimum > 1:
l1, l2 = node_factory.line_graph(2, fundamount=10**6,
opts={'feerates': (15000, 15000, 15000, 15000)})
try:
print(f"XXX Trying {(minimum + maximum) // 2}")
l1.pay(l2, (minimum + maximum) // 2 * 1000)
minimum = (minimum + maximum) // 2
except RpcError:
maximum = (minimum + maximum) // 2
print("NEW BEST")
print("{} - {}".format(minimum, maximum))
assert False

# This is the fee, which needs to be taken into account for l1.
if anchors:
Expand Down

0 comments on commit 79aa46f

Please sign in to comment.