MCPcopy Create free account
hub / github.com/ElementsProject/lightning / test_htlc_timeout_boost_large_utxo

Function test_htlc_timeout_boost_large_utxo

tests/test_closing.py:4294–4322  ·  view source on GitHub ↗

A large wallet UTXO must not abort lightningd when boosting an HTLC timeout.

(node_factory, bitcoind)

Source from the content-addressed store, hash-verified

4292
4293@unittest.skipIf(TEST_NETWORK != 'regtest', 'Large BTC UTXO amounts are bitcoin-regtest specific')
4294def test_htlc_timeout_boost_large_utxo(node_factory, bitcoind):
4295 """A large wallet UTXO must not abort lightningd when boosting an HTLC timeout."""
4296 l1, l2 = node_factory.get_nodes(2, opts=[{}, {'disconnect': ['-WIRE_UPDATE_FAIL_HTLC']}])
4297 l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
4298
4299 # Fund first so the channel open leaves a single huge change output.
4300 l1.fundwallet(40 * 10**8)
4301 l1.rpc.fundchannel(l2.info['id'], 10**5)
4302
4303 bitcoind.generate_block(1, wait_for_mempool=1)
4304 sync_blockheight(bitcoind, [l1, l2])
4305 wait_for(lambda: only_one(l1.rpc.listpeerchannels()['channels'])['state'] == 'CHANNELD_NORMAL')
4306 wait_for(lambda: only_one(l2.rpc.listpeerchannels()['channels'])['state'] == 'CHANNELD_NORMAL')
4307
4308 inv = l2.rpc.invoice(10**6, 'inv', 'desc')
4309 l2.rpc.delinvoice('inv', 'unpaid')
4310 l1.rpc.sendpay([{'amount_msat': 10**6, 'id': l2.info['id'], 'delay': 12,
4311 'channel': first_scid(l1, l2)}],
4312 inv['payment_hash'], payment_secret=inv['payment_secret'])
4313 l2.daemon.wait_for_log('dev_disconnect')
4314
4315 l1.rpc.dev_fail(l2.info['id'])
4316 l1.wait_for_channel_onchain(l2.info['id'])
4317 bitcoind.generate_block(1, wait_for_mempool=1)
4318
4319 # Before the fix, calc_feerate() abort()ed here.
4320 log_line = l1.daemon.wait_for_log("wallet_utxo_boost")
4321 assert "got 1 UTXOs" in log_line
4322 l1.wait_for_onchaind_tx('OUR_HTLC_TIMEOUT_TX', 'OUR_UNILATERAL/OUR_HTLC')
4323
4324
4325@pytest.mark.parametrize("anchors", [False, True])

Callers

nothing calls this directly

Calls 15

sync_blockheightFunction · 0.90
wait_forFunction · 0.90
only_oneFunction · 0.90
first_scidFunction · 0.90
get_nodesMethod · 0.80
fundwalletMethod · 0.80
generate_blockMethod · 0.80
listpeerchannelsMethod · 0.80
delinvoiceMethod · 0.80
sendpayMethod · 0.80
wait_for_logMethod · 0.80
dev_failMethod · 0.80

Tested by

no test coverage detected