Test that fundee will successfully broadcast and funder still has correct UTXOs/correctly advances the channel
(node_factory, bitcoind)
| 2889 | |
| 2890 | @pytest.mark.openchannel('v2') |
| 2891 | def test_fundee_node_unconfirmed(node_factory, bitcoind): |
| 2892 | """Test that fundee will successfully broadcast and |
| 2893 | funder still has correct UTXOs/correctly advances the channel |
| 2894 | """ |
| 2895 | # opener |
| 2896 | l1, l2 = node_factory.line_graph(2, fundchannel=False) |
| 2897 | |
| 2898 | # Give opener some funds. |
| 2899 | l1.fundwallet(10**7) |
| 2900 | |
| 2901 | start_amount = only_one(l1.rpc.listfunds()['outputs'])['amount_msat'] |
| 2902 | |
| 2903 | def mock_sendrawtransaction(r): |
| 2904 | return {'id': r['id'], 'error': {'code': 100, 'message': 'sendrawtransaction disabled'}} |
| 2905 | |
| 2906 | def mock_donothing(r): |
| 2907 | time.sleep(10) |
| 2908 | return bitcoind.rpc.sendrawtransaction(r['params'][0]) |
| 2909 | |
| 2910 | # Prevent both from broadcasting funding tx (any tx really). |
| 2911 | l1.daemon.rpcproxy.mock_rpc('sendrawtransaction', mock_sendrawtransaction) |
| 2912 | l2.daemon.rpcproxy.mock_rpc('sendrawtransaction', mock_donothing) |
| 2913 | |
| 2914 | # Fund the channel. |
| 2915 | # The process will complete, but opener will be unable |
| 2916 | # to broadcast and confirm funding tx. |
| 2917 | with pytest.raises(RpcError, match=r'sendrawtransaction disabled'): |
| 2918 | l1.rpc.fundchannel(l2.info['id'], 10**6) |
| 2919 | |
| 2920 | # Generate blocks until unconfirmed. |
| 2921 | bitcoind.generate_block(1, wait_for_mempool=1) |
| 2922 | |
| 2923 | # Check that l1 opened the channel |
| 2924 | wait_for(lambda: only_one(l1.rpc.listpeerchannels()['channels'])['state'] == 'CHANNELD_NORMAL') |
| 2925 | end_amount = only_one(l1.rpc.listfunds()['outputs'])['amount_msat'] |
| 2926 | # We should be out the onchaind fees |
| 2927 | assert start_amount > end_amount + Millisatoshi(10 ** 7 * 100) |
| 2928 | |
| 2929 | |
| 2930 | def test_no_fee_estimate(node_factory, bitcoind, executor): |
nothing calls this directly
no test coverage detected