diff --git a/openingd/openingd.c b/openingd/openingd.c index 1990a9d293..23331faff7 100644 --- a/openingd/openingd.c +++ b/openingd/openingd.c @@ -316,6 +316,20 @@ static u8 *funder_channel_start(struct state *state, u8 channel_flags, state->feerate_per_kw = nonanchor_feerate; } + /* If they use the same settings as us, would we fail? If so, do that now. */ + if (!check_config_bounds(tmpctx, state->funding_sats, + state->feerate_per_kw, + state->max_to_self_delay, + state->min_effective_htlc_capacity, + &state->localconf, + &state->localconf, + channel_type_has(state->channel_type, OPT_ANCHORS_ZERO_FEE_HTLC_TX), + &err_reason)) { + negotiation_aborted(state, + tal_fmt(tmpctx, "Not opening because if they used the same setting as us %s", + err_reason)); + } + open_tlvs = tlv_open_channel_tlvs_new(tmpctx); open_tlvs->upfront_shutdown_script = state->upfront_shutdown_script[LOCAL]; diff --git a/tests/test_connection.py b/tests/test_connection.py index defeeea430..ed81c75f52 100644 --- a/tests/test_connection.py +++ b/tests/test_connection.py @@ -327,26 +327,6 @@ def test_balance(node_factory): assert p2['total_msat'] == 10**6 * 1000 -@pytest.mark.openchannel('v1') -@pytest.mark.openchannel('v2') -def test_bad_opening(node_factory): - # l1 asks for a too-long locktime - l1 = node_factory.get_node(options={'watchtime-blocks': 2017}) - l2 = node_factory.get_node() - ret = l1.rpc.connect(l2.info['id'], 'localhost', l2.port) - - assert ret['id'] == l2.info['id'] - - l1.daemon.wait_for_log('Handed peer, entering loop') - l2.daemon.wait_for_log('Handed peer, entering loop') - - l1.fundwallet(10**6 + 1000000) - with pytest.raises(RpcError): - l1.rpc.fundchannel(l2.info['id'], 10**6) - - l2.daemon.wait_for_log('to_self_delay 2017 larger than 2016') - - @unittest.skipIf(TEST_NETWORK != 'regtest', "Fee computation and limits are network specific") @pytest.mark.slow_test @pytest.mark.openchannel('v1') diff --git a/tests/test_opening.py b/tests/test_opening.py index 65fa44b5c9..e533d1f873 100644 --- a/tests/test_opening.py +++ b/tests/test_opening.py @@ -2799,7 +2799,7 @@ def test_zeroconf_forget(node_factory, bitcoind, dopay: bool): @unittest.skipIf(TEST_NETWORK != 'regtest', 'elementsd gives different numbers') -@pytest.mark.xfail(strict=True) +@pytest.mark.openchannel('v1') def test_opening_below_min_capacity_sat(bitcoind, node_factory): """OK, here's what happens: