(node_factory)
| 2582 | @pytest.mark.openchannel('v1') |
| 2583 | @pytest.mark.openchannel('v2') |
| 2584 | def test_forget_channel(node_factory): |
| 2585 | l1 = node_factory.get_node() |
| 2586 | l2 = node_factory.get_node() |
| 2587 | l1.fundwallet(10**6) |
| 2588 | l1.rpc.connect(l2.info['id'], 'localhost', l2.port) |
| 2589 | l1.rpc.fundchannel(l2.info['id'], 10**5) |
| 2590 | |
| 2591 | assert len(l1.rpc.listpeers()['peers']) == 1 |
| 2592 | |
| 2593 | # This should fail, the funding tx is in the mempool and may confirm |
| 2594 | with pytest.raises(RpcError, match=r'Cowardly refusing to forget channel'): |
| 2595 | l1.rpc.dev_forget_channel(l2.info['id']) |
| 2596 | |
| 2597 | assert len(l1.rpc.listpeers()['peers']) == 1 |
| 2598 | |
| 2599 | # Forcing should work |
| 2600 | l1.rpc.dev_forget_channel(l2.info['id'], True) |
| 2601 | wait_for(lambda: only_one(l1.rpc.listpeers()['peers'])['channels'] == []) |
| 2602 | |
| 2603 | # And restarting should keep that peer forgotten |
| 2604 | l1.restart() |
| 2605 | assert len(l1.rpc.listpeers()['peers']) == 0 |
| 2606 | |
| 2607 | # The entry in the channels table should still be there |
| 2608 | assert l1.db_query("SELECT count(*) as c FROM channels;")[0]['c'] == 1 |
| 2609 | assert l2.db_query("SELECT count(*) as c FROM channels;")[0]['c'] == 1 |
| 2610 | |
| 2611 | |
| 2612 | @pytest.mark.openchannel('v1') |
nothing calls this directly
no test coverage detected