From 8d28e52515e322ee351d269c4fac21c295f7f996 Mon Sep 17 00:00:00 2001 From: trueptolemy Date: Fri, 6 Sep 2019 13:34:24 +0800 Subject: [PATCH] pytest: Test `fundchannel_cancel` can catch tx braodcast by bitcoind For now, we can't fully ensure that the broadcast was catched from a third pary. Only when the transaction (broadcast by a third pary) is onchain, we can catch it. --- tests/test_connection.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/test_connection.py b/tests/test_connection.py index 397e3b6bf..f6a4ddf5a 100644 --- a/tests/test_connection.py +++ b/tests/test_connection.py @@ -1022,6 +1022,11 @@ def test_funding_external_wallet(node_factory, bitcoind): l1.daemon.wait_for_log(r'Funding tx {} depth 1 of 1'.format(txid)) + # Check that tx is broadcast by a third party can be catched. + # Only when the transaction (broadcast by a third pary) is onchain, we can catch it. + with pytest.raises(RpcError, match=r'.* been broadcast.*'): + l1.rpc.fundchannel_cancel(l2.info['id']) + for node in [l1, l2]: node.daemon.wait_for_log(r'State changed from CHANNELD_AWAITING_LOCKIN to CHANNELD_NORMAL') channel = node.rpc.listpeers()['peers'][0]['channels'][0]