diff --git a/tests/test_opening.py b/tests/test_opening.py index a8090f9ac697..fb0fa33e4148 100644 --- a/tests/test_opening.py +++ b/tests/test_opening.py @@ -17,6 +17,34 @@ def find_next_feerate(node, peer): chan = only_one(node.rpc.listpeerchannels(peer.info['id'])['channels']) return chan['next_feerate'] +@pytest.mark.openchannel('v1') +@pytest.mark.xfail(strict=True) +@unittest.skipIf(TEST_NETWORK != 'regtest', "requires regtest") +def test_opening_with_unknown_feerates(node_factory, bitcoind): + """ + Test openchannel when feerates are unknown (like on signet/testnet with empty mempool). + """ + opts = { + 'feerates': None, + 'dev-no-fake-fees': True, + } + + l1, l2 = node_factory.get_nodes(2, opts=[opts, {}]) + + # Verify fee estimation is failing only on l1 + l1.daemon.wait_for_log('Unable to estimate any fees') + + # Connect nodes and fund l1 + l1.rpc.connect(l2.info['id'], 'localhost', l2.port) + l1.fundwallet(10000000) + + # Opening should fail due to unknown feerates + with pytest.raises(RpcError, match=r"Cannot estimate fees"): + l1.rpc.fundchannel(l2.info['id'], 1000000, minconf=0) + + # Opening should work fine since fees are specified manually + l1.rpc.fundchannel(l2.info['id'], 1000000, feerate='1perkw', minconf=0) + @unittest.skipIf(TEST_NETWORK != 'regtest', 'elementsd doesnt yet support PSBT features we need') @pytest.mark.openchannel('v2')