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

Function test_closing_tx_valid

tests/test_closing.py:4398–4422  ·  view source on GitHub ↗
(node_factory, bitcoind)

Source from the content-addressed store, hash-verified

4396
4397
4398def test_closing_tx_valid(node_factory, bitcoind):
4399 l1, l2 = node_factory.line_graph(2, opts={'may_reconnect': True,
4400 'dev-no-reconnect': None})
4401
4402 # First, mutual close.
4403 close = l1.rpc.close(l2.info['id'])
4404
4405 wait_for(lambda: len(bitcoind.rpc.getrawmempool()) == 1)
4406 assert only_one(bitcoind.rpc.getrawmempool()) == only_one(close['txids'])
4407 assert bitcoind.rpc.getrawtransaction(only_one(close['txids'])) == only_one(close['txs'])
4408 bitcoind.generate_block(1)
4409 # Change output and the closed channel output.
4410 wait_for(lambda: [o['status'] for o in l1.rpc.listfunds()['outputs']] == ['confirmed'] * 2)
4411
4412 # Now, unilateral close.
4413 l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
4414 l1.rpc.fundchannel(l2.info['id'], 10**6)
4415 bitcoind.generate_block(1, wait_for_mempool=1)
4416
4417 l1.rpc.disconnect(l2.info['id'], force=True)
4418 close = l1.rpc.close(l2.info['id'], 1)
4419
4420 wait_for(lambda: len(bitcoind.rpc.getrawmempool()) == 1)
4421 assert only_one(bitcoind.rpc.getrawmempool()) == only_one(close['txids'])
4422 assert bitcoind.rpc.getrawtransaction(only_one(close['txids'])) == only_one(close['txs'])
4423
4424
4425@unittest.skipIf(TEST_NETWORK != 'regtest', 'elementsd does not provide feerates on regtest')

Callers

nothing calls this directly

Calls 9

wait_forFunction · 0.90
only_oneFunction · 0.90
line_graphMethod · 0.80
generate_blockMethod · 0.80
closeMethod · 0.45
listfundsMethod · 0.45
connectMethod · 0.45
fundchannelMethod · 0.45
disconnectMethod · 0.45

Tested by

no test coverage detected