diff --git a/lightningd/peer_control.c b/lightningd/peer_control.c index e4b49569d..cafdb6256 100644 --- a/lightningd/peer_control.c +++ b/lightningd/peer_control.c @@ -613,6 +613,7 @@ static void subtract_received_htlcs(const struct channel *channel, struct amount_msat channel_amount_spendable(const struct channel *channel) { struct amount_msat spendable; + bool wumbo; /* Compute how much we can send via this channel in one payment. */ if (!amount_msat_sub_sat(&spendable, @@ -636,9 +637,15 @@ struct amount_msat channel_amount_spendable(const struct channel *channel) channel->channel_info.their_config.htlc_minimum)) return AMOUNT_MSAT(0); + wumbo = feature_negotiated(channel->peer->ld->our_features, + channel->peer->their_features, + OPT_LARGE_CHANNELS); + /* We can't offer an HTLC over the max payment threshold either. */ - if (amount_msat_greater(spendable, chainparams->max_payment)) + if (amount_msat_greater(spendable, chainparams->max_payment) + && !wumbo) { spendable = chainparams->max_payment; + } return spendable; } @@ -646,6 +653,7 @@ struct amount_msat channel_amount_spendable(const struct channel *channel) struct amount_msat channel_amount_receivable(const struct channel *channel) { struct amount_msat their_msat, receivable; + bool wumbo; /* Compute how much we can receive via this channel in one payment */ if (!amount_sat_sub_msat(&their_msat, @@ -672,9 +680,15 @@ struct amount_msat channel_amount_receivable(const struct channel *channel) if (amount_msat_less(receivable, channel->our_config.htlc_minimum)) return AMOUNT_MSAT(0); + wumbo = feature_negotiated(channel->peer->ld->our_features, + channel->peer->their_features, + OPT_LARGE_CHANNELS); + /* They can't offer an HTLC over the max payment threshold either. */ - if (amount_msat_greater(receivable, chainparams->max_payment)) + if (amount_msat_greater(receivable, chainparams->max_payment) + && !wumbo) { receivable = chainparams->max_payment; + } return receivable; } diff --git a/tests/test_connection.py b/tests/test_connection.py index be08021a8..c46fb6635 100644 --- a/tests/test_connection.py +++ b/tests/test_connection.py @@ -3407,7 +3407,6 @@ def test_pay_disconnect_stress(node_factory, executor): @pytest.mark.openchannel('v1') @pytest.mark.openchannel('v2') -@pytest.mark.xfail(strict=True) def test_wumbo_channels(node_factory, bitcoind): l1, l2, l3 = node_factory.get_nodes(3, opts=[{'large-channels': None},