dev_ping: don't crash with silly values.

It's a dev command, but still.

Fixes: #985
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2018-02-20 16:37:18 +10:30
parent 91a9c2923f
commit b536e97df2
2 changed files with 31 additions and 0 deletions

View File

@@ -1851,6 +1851,11 @@ class LightningDTests(BaseLightningDTests):
ret = l1.rpc.dev_ping(l2.info['id'], 1000, s)
assert ret['totlen'] == 0
# 65535 - type(2 bytes) - num_pong_bytes(2 bytes) - byteslen(2 bytes)
# = 65529 max.
self.assertRaisesRegex(ValueError, r'oversize ping',
l1.rpc.dev_ping, l2.info['id'], 65530, 1)
@unittest.skipIf(not DEVELOPER, "needs DEVELOPER=1")
def test_ping(self):
l1,l2 = self.connect()