OK, here's what happens: The user configures min-capacity-sat=2,000,000. They try to open a channel with 591,000 sat We let them (for some reason), which kinda makes sense: it's their own rules We then get upset when you accept! The "capacity" here is the effective capacity of
(bitcoind, node_factory)
| 3429 | @unittest.skipIf(TEST_NETWORK != 'regtest', 'elementsd gives different numbers') |
| 3430 | @pytest.mark.openchannel('v1') |
| 3431 | def test_opening_below_min_capacity_sat(bitcoind, node_factory): |
| 3432 | """OK, here's what happens: |
| 3433 | |
| 3434 | The user configures min-capacity-sat=2,000,000. |
| 3435 | They try to open a channel with 591,000 sat |
| 3436 | We let them (for some reason), which kinda makes sense: it's their own rules |
| 3437 | We then get upset when you accept! |
| 3438 | |
| 3439 | The "capacity" here is the effective capacity of the channel, which is capped at funding - (reserves and 2 anchors), and at max_htlc_value_in_flight. |
| 3440 | """ |
| 3441 | l1, l2 = node_factory.line_graph(2, fundchannel=False, opts=[{'min-capacity-sat': 2_000_000}, {}]) |
| 3442 | |
| 3443 | l1.fundwallet(3_000_000) |
| 3444 | |
| 3445 | with pytest.raises(RpcError, match=r'which is below 2000000sat'): |
| 3446 | l1.rpc.fundchannel(l2.info['id'], "591000sat") |
| 3447 | |
| 3448 | l1.connect(l2) |
| 3449 | |
| 3450 | # Even with the exact amount, the *capacity* is different. |
| 3451 | with pytest.raises(RpcError, match=r'channel capacity is 1955125sat, which is below 2000000sat'): |
| 3452 | l1.rpc.fundchannel(l2.info['id'], "2000000sat") |
| 3453 | |
| 3454 | # But we shouldn't have bothered l2 |
| 3455 | assert not l2.daemon.is_in_log('peer_in WIRE_ERROR') |
| 3456 | |
| 3457 | |
| 3458 | @pytest.mark.openchannel('v1') |
nothing calls this directly
no test coverage detected