diff --git a/tests/test_opening.py b/tests/test_opening.py index a8090f9ac697..4571fb0260b3 100644 --- a/tests/test_opening.py +++ b/tests/test_opening.py @@ -17,6 +17,45 @@ def find_next_feerate(node, peer): chan = only_one(node.rpc.listpeerchannels(peer.info['id'])['channels']) return chan['next_feerate'] +@pytest.mark.openchannel('v2') +@unittest.skipIf(TEST_NETWORK != 'regtest', "requires regtest") +def test_opening_dualfund_with_unknown_feerates(node_factory, bitcoind): + """ + Test dualfund openchannel when feerates are unknown (like on signet/testnet with empty mempool). + """ + opts = { + 'ignore-fee-limits': True, + 'feerates': None, + 'dev-no-fake-fees': True, + 'experimental-dual-fund': None + } + + l1, l2= node_factory.get_nodes(2, opts=[opts, opts]) + + l1.fundwallet(FUNDAMOUNT) + + # Connect peers + l1.rpc.connect(l2.info['id'], 'localhost', l2.port) + + # Verify fee estimation is failing + l1.daemon.wait_for_log('Unable to estimate any fees') + l2.daemon.wait_for_log('Unable to estimate any fees') + + # Open channel l1 <-> l2 + fund_tx = l1.rpc.fundchannel(l2.info['id'], 100000, feerate='253perkw', minconf=0)['txid'] + + # Verify mempool is not empty + mempool = bitcoind.rpc.getrawmempool() + assert fund_tx in mempool and len(mempool) == 1 + + # Verify fee estimation is still failing + l1.daemon.wait_for_log('Unable to estimate any fees') + l2.daemon.wait_for_log('Unable to estimate any fees') + + # Mine blocks to confirm channels + bitcoind.generate_block(1, wait_for_mempool=1) + + l2.rpc.listpeerchannels(l1.info['id'])['channels'] @unittest.skipIf(TEST_NETWORK != 'regtest', 'elementsd doesnt yet support PSBT features we need') @pytest.mark.openchannel('v2')