(node_factory)
| 2712 | @pytest.mark.openchannel('v1') |
| 2713 | @pytest.mark.openchannel('v2') |
| 2714 | def test_forget_channel(node_factory): |
| 2715 | l1 = node_factory.get_node() |
| 2716 | l2 = node_factory.get_node() |
| 2717 | l1.fundwallet(10**6) |
| 2718 | l1.rpc.connect(l2.info['id'], 'localhost', l2.port) |
| 2719 | l1.rpc.fundchannel(l2.info['id'], 10**5) |
| 2720 | |
| 2721 | assert len(l1.rpc.listpeers()['peers']) == 1 |
| 2722 | |
| 2723 | # This should fail, the funding tx is in the mempool and may confirm |
| 2724 | with pytest.raises(RpcError, match=r'Cowardly refusing to forget channel'): |
| 2725 | l1.rpc.dev_forget_channel(l2.info['id']) |
| 2726 | |
| 2727 | assert len(l1.rpc.listpeers()['peers']) == 1 |
| 2728 | |
| 2729 | # Forcing should work |
| 2730 | l1.rpc.dev_forget_channel(l2.info['id'], True) |
| 2731 | wait_for(lambda: l1.rpc.listpeerchannels()['channels'] == []) |
| 2732 | |
| 2733 | # And restarting should keep that peer forgotten |
| 2734 | l1.restart() |
| 2735 | assert len(l1.rpc.listpeers()['peers']) == 0 |
| 2736 | |
| 2737 | # The entry in the channels table should still be there |
| 2738 | assert l1.db_query("SELECT count(*) as c FROM channels;")[0]['c'] == 1 |
| 2739 | assert l2.db_query("SELECT count(*) as c FROM channels;")[0]['c'] == 1 |
| 2740 | |
| 2741 | |
| 2742 | @pytest.mark.openchannel('v1') |
nothing calls this directly
no test coverage detected