diff --git a/lightningd/opening_control.c b/lightningd/opening_control.c index 3aa7c1a18c0f..8fba03fbc52e 100644 --- a/lightningd/opening_control.c +++ b/lightningd/opening_control.c @@ -1031,9 +1031,11 @@ static struct command_result *json_fundchannel_complete(struct command *cmd, return command_fail(cmd, FUNDING_PSBT_INVALID, "No output to open channel"); - if (!amount_sat_eq(amount_sat(funding_psbt->tx->outputs - [*funding_txout_num].satoshi), - fc->funding)) + /* Can't really check amounts for elements. */ + if (!chainparams->is_elements + && !amount_sat_eq(amount_sat(funding_psbt->tx->outputs + [*funding_txout_num].satoshi), + fc->funding)) return command_fail(cmd, FUNDING_PSBT_INVALID, "Output to open channel is %"PRIu64"sat," " should be %s", diff --git a/tests/test_connection.py b/tests/test_connection.py index 160375416d63..045b0bf77f55 100644 --- a/tests/test_connection.py +++ b/tests/test_connection.py @@ -1094,11 +1094,12 @@ def test_funding_external_wallet_corners(node_factory, bitcoind): with pytest.raises(RpcError, match=r'Already funding channel'): l1.rpc.fundchannel(l2.info['id'], amount) - # Can't complete with incorrect amount. - wrongamt = l1.rpc.txprepare([{start['funding_address']: amount - 1}]) - with pytest.raises(RpcError, match=r'Output to open channel is .*, should be .*'): - l1.rpc.fundchannel_complete(l2.info['id'], wrongamt['psbt']) - l1.rpc.txdiscard(wrongamt['txid']) + # Can't complete with incorrect amount (unchecked on Elements) + if TEST_NETWORK == 'regtest': + wrongamt = l1.rpc.txprepare([{start['funding_address']: amount - 1}]) + with pytest.raises(RpcError, match=r'Output to open channel is .*, should be .*'): + l1.rpc.fundchannel_complete(l2.info['id'], wrongamt['psbt']) + l1.rpc.txdiscard(wrongamt['txid']) # Can't complete with incorrect address. wrongaddr = l1.rpc.txprepare([{l1.rpc.newaddr()['bech32']: amount}])