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

Function test_onchain_rexmit_tx

tests/test_closing.py:4167–4187  ·  view source on GitHub ↗

Make sure we re-xmit last tx if we restart and channel is AWAITING_UNILATERAL

(node_factory, bitcoind)

Source from the content-addressed store, hash-verified

4165
4166
4167def test_onchain_rexmit_tx(node_factory, bitcoind):
4168 """Make sure we re-xmit last tx if we restart and channel is AWAITING_UNILATERAL"""
4169 l1, l2 = node_factory.line_graph(2)
4170
4171 def ignore_sendrawtx(r):
4172 return {'id': r['id'], 'result': {}}
4173
4174 l1.daemon.rpcproxy.mock_rpc('sendrawtransaction', ignore_sendrawtx)
4175
4176 l2.stop()
4177 l1.rpc.close(l2.info['id'], unilateraltimeout=1)
4178
4179 peer = only_one(l1.rpc.listpeers()["peers"])
4180 wait_for(lambda: only_one(l1.rpc.listpeerchannels(peer["id"])['channels'])['state'] == 'AWAITING_UNILATERAL')
4181 l1.stop()
4182
4183 assert bitcoind.rpc.getrawmempool() == []
4184 l1.daemon.rpcproxy.mock_rpc('sendrawtransaction', None)
4185
4186 l1.start()
4187 wait_for(lambda: len(bitcoind.rpc.getrawmempool()) == 1)
4188
4189
4190@unittest.skipIf(TEST_NETWORK != 'regtest', 'elementsd anchors unsupported')

Callers

nothing calls this directly

Calls 9

only_oneFunction · 0.90
wait_forFunction · 0.90
line_graphMethod · 0.80
mock_rpcMethod · 0.80
listpeerchannelsMethod · 0.80
stopMethod · 0.45
closeMethod · 0.45
listpeersMethod · 0.45
startMethod · 0.45

Tested by

no test coverage detected