sendpay msatoshi arg was used for non-MPP to indicate the amount they asked for. But using it with anything other than the final amount caused a crash in 0.8.0, so we then disallowed it.
(node_factory)
| 3417 | |
| 3418 | |
| 3419 | def test_sendpay_msatoshi_arg(node_factory): |
| 3420 | """sendpay msatoshi arg was used for non-MPP to indicate the amount |
| 3421 | they asked for. But using it with anything other than the final amount |
| 3422 | caused a crash in 0.8.0, so we then disallowed it. |
| 3423 | """ |
| 3424 | l1, l2 = node_factory.line_graph(2) |
| 3425 | |
| 3426 | inv = l2.rpc.invoice(1000, 'inv', 'inv') |
| 3427 | |
| 3428 | # Can't send non-MPP payment which specifies msatoshi != final. |
| 3429 | with pytest.raises(RpcError, match=r'Do not specify msatoshi \(1001msat\) without' |
| 3430 | ' partid: if you do, it must be exactly' |
| 3431 | r' the final amount \(1000msat\)'): |
| 3432 | l1.rpc.sendpay(route=l1.single_route(l2.info['id'], 1000), payment_hash=inv['payment_hash'], amount_msat=1001, bolt11=inv['bolt11'], payment_secret=inv['payment_secret']) |
| 3433 | with pytest.raises(RpcError, match=r'Do not specify msatoshi \(999msat\) without' |
| 3434 | ' partid: if you do, it must be exactly' |
| 3435 | r' the final amount \(1000msat\)'): |
| 3436 | l1.rpc.sendpay(route=l1.single_route(l2.info['id'], 1000), payment_hash=inv['payment_hash'], amount_msat=999, bolt11=inv['bolt11'], payment_secret=inv['payment_secret']) |
| 3437 | |
| 3438 | # Can't send MPP payment which pays any more than amount. |
| 3439 | with pytest.raises(RpcError, match=r'Final amount 1001msat is greater than 1000msat, despite MPP'): |
| 3440 | l1.rpc.sendpay(route=l1.single_route(l2.info['id'], 1001), payment_hash=inv['payment_hash'], amount_msat=1000, bolt11=inv['bolt11'], partid=1, payment_secret=inv['payment_secret']) |
| 3441 | |
| 3442 | # But this works |
| 3443 | l1.rpc.sendpay(route=l1.single_route(l2.info['id'], 1001), payment_hash=inv['payment_hash'], amount_msat=1001, bolt11=inv['bolt11'], payment_secret=inv['payment_secret']) |
| 3444 | l1.rpc.waitsendpay(inv['payment_hash']) |
| 3445 | |
| 3446 | inv = only_one(l2.rpc.listinvoices('inv')['invoices']) |
| 3447 | assert inv['status'] == 'paid' |
| 3448 | assert inv['amount_received_msat'] == Millisatoshi(1001) |
| 3449 | |
| 3450 | |
| 3451 | def test_reject_invalid_payload(node_factory): |
nothing calls this directly
no test coverage detected