Skip to content

Commit b6555dc

Browse files
rustyrussellcdecker
authored andcommitted
pytest: test for wumbo direct payments.
We should be able to make larger payments if we're directly connected. Signed-off-by: Rusty Russell <[email protected]>
1 parent 15d0a8b commit b6555dc

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

tests/test_connection.py

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3407,6 +3407,7 @@ def test_pay_disconnect_stress(node_factory, executor):
34073407

34083408
@pytest.mark.openchannel('v1')
34093409
@pytest.mark.openchannel('v2')
3410+
@pytest.mark.xfail(strict=True)
34103411
def test_wumbo_channels(node_factory, bitcoind):
34113412
l1, l2, l3 = node_factory.get_nodes(3,
34123413
opts=[{'large-channels': None},
@@ -3465,9 +3466,29 @@ def test_wumbo_channels(node_factory, bitcoind):
34653466
wait_for(lambda: 'CHANNELD_NORMAL' in [c['state'] for c in only_one(l1.rpc.listpeers(l2.info['id'])['peers'])['channels']])
34663467

34673468
# Exact amount depends on fees, but it will be wumbo!
3468-
amount = [c['funding']['local_funds_msat'] for c in only_one(l1.rpc.listpeers(l2.info['id'])['peers'])['channels'] if c['state'] == 'CHANNELD_NORMAL'][0]
3469+
chan = only_one([c for c in only_one(l1.rpc.listpeers(l2.info['id'])['peers'])['channels'] if c['state'] == 'CHANNELD_NORMAL'])
3470+
amount = chan['funding']['local_funds_msat']
34693471
assert amount > Millisatoshi(str((1 << 24) - 1) + "sat")
34703472

3473+
# We should know we can spend that much!
3474+
spendable = chan['spendable_msat']
3475+
assert spendable > Millisatoshi(str((1 << 24) - 1) + "sat")
3476+
3477+
# So should peer.
3478+
chan = only_one([c for c in only_one(l2.rpc.listpeers(l1.info['id'])['peers'])['channels'] if c['state'] == 'CHANNELD_NORMAL'])
3479+
assert chan['receivable_msat'] == spendable
3480+
3481+
# And we can wumbo pay, right?
3482+
inv = l2.rpc.invoice(str(1 << 24) + "sat", "test_wumbo_channels", "wumbo payment")
3483+
# We actually do warn about capacity: l2 sees that *l1* doesn't have
3484+
# enough incoming to pay (not knowing that l1 is the intended payer).
3485+
assert 'warning_capacity' in inv
3486+
assert 'warning_mpp' not in inv
3487+
3488+
l1.rpc.pay(inv['bolt11'])
3489+
# Done in a single shot!
3490+
assert len(l1.rpc.listsendpays()['payments']) == 1
3491+
34713492

34723493
@pytest.mark.openchannel('v1')
34733494
@pytest.mark.openchannel('v2')

0 commit comments

Comments
 (0)