Skip to content

Commit 21d1954

Browse files
committed
pytest: test case where we crash before bitcoind gets the opening tx.
Signed-off-by: Rusty Russell <[email protected]>
1 parent c43206e commit 21d1954

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

tests/test_opening.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2825,3 +2825,26 @@ def test_opening_below_min_capacity_sat(bitcoind, node_factory):
28252825

28262826
# But we shouldn't have bothered l2
28272827
assert not l2.daemon.is_in_log('peer_in WIRE_ERROR')
2828+
2829+
2830+
@pytest.mark.xfail(strict=True)
2831+
@pytest.mark.openchannel('v1')
2832+
@pytest.mark.openchannel('v2')
2833+
def test_opening_crash(bitcoind, node_factory):
2834+
"""Stop transmission of initial funding tx, check it eventually opens"""
2835+
l1, l2 = node_factory.get_nodes(2)
2836+
2837+
def censoring_sendrawtx(r):
2838+
return {'id': r['id'], 'result': {}}
2839+
2840+
l1.daemon.rpcproxy.mock_rpc('sendrawtransaction', censoring_sendrawtx)
2841+
l2.daemon.rpcproxy.mock_rpc('sendrawtransaction', censoring_sendrawtx)
2842+
l1.fundwallet(3_000_000)
2843+
l1.connect(l2)
2844+
txid = l1.rpc.fundchannel(l2.info['id'], "2000000sat")['txid']
2845+
2846+
l1.stop()
2847+
l1.daemon.rpcproxy.mock_rpc('sendrawtransaction', None)
2848+
l1.start()
2849+
2850+
bitcoind.generate_block(1, wait_for_mempool=txid)

0 commit comments

Comments
 (0)