|
|
@ -3405,6 +3405,28 @@ class LightningDTests(BaseLightningDTests): |
|
|
|
except: |
|
|
|
pass |
|
|
|
|
|
|
|
@unittest.skipIf(not DEVELOPER, "needs DEVELOPER=1") |
|
|
|
def test_forget_channel(self): |
|
|
|
l1 = self.node_factory.get_node() |
|
|
|
l2 = self.node_factory.get_node() |
|
|
|
self.give_funds(l1, 10**6) |
|
|
|
l1.rpc.connect(l2.info['id'], 'localhost', l2.info['port']) |
|
|
|
l1.rpc.fundchannel(l2.info['id'], 10**5) |
|
|
|
|
|
|
|
assert len(l1.rpc.listpeers()['peers']) == 1 |
|
|
|
|
|
|
|
# This should fail, the funding tx is in the mempool and may confirm |
|
|
|
self.assertRaises(ValueError, l1.rpc.dev_forget_channel, l2.info['id']) |
|
|
|
assert len(l1.rpc.listpeers()['peers']) == 1 |
|
|
|
|
|
|
|
# Forcing should work |
|
|
|
l1.rpc.dev_forget_channel(l2.info['id'], True) |
|
|
|
assert len(l1.rpc.listpeers()['peers']) == 0 |
|
|
|
|
|
|
|
# And restarting should keep that peer forgotten |
|
|
|
l1.restart() |
|
|
|
assert len(l1.rpc.listpeers()['peers']) == 0 |
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__': |
|
|
|
unittest.main(verbosity=2) |
|
|
|