Browse Source

pytest: Add test for `dev-forget-channel`

Signed-off-by: Christian Decker <decker.christian@gmail.com>
ppa-0.6.1
Christian Decker 7 years ago
committed by Rusty Russell
parent
commit
b3d4e161b5
  1. 22
      tests/test_lightningd.py

22
tests/test_lightningd.py

@ -3405,6 +3405,28 @@ class LightningDTests(BaseLightningDTests):
except: except:
pass 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__': if __name__ == '__main__':
unittest.main(verbosity=2) unittest.main(verbosity=2)

Loading…
Cancel
Save