From 23a8f09b4ded127964626b97681aa6378fbae978 Mon Sep 17 00:00:00 2001 From: Michael Schmoock Date: Mon, 21 Feb 2022 11:02:28 +0100 Subject: [PATCH] noise: fix #331 fixes an off by one error --- noise/noise.py | 2 +- noise/test_chat.py | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/noise/noise.py b/noise/noise.py index 697edc2..e243a93 100755 --- a/noise/noise.py +++ b/noise/noise.py @@ -160,7 +160,7 @@ def recvmsg(plugin, request, last_id=None, **kwargs): Returns a `concurrent.futures.Future`. Optional parameter `last_id` can be supplied to return an older message. """ - next_id = int(last_id) + 1 if last_id is not None else len(plugin.messages) + next_id = int(last_id) if last_id is not None else len(plugin.messages) if next_id < len(plugin.messages): res = plugin.messages[int(last_id)].to_dict() res['total_messages'] = len(plugin.messages) diff --git a/noise/test_chat.py b/noise/test_chat.py index 8be9572..41f2300 100644 --- a/noise/test_chat.py +++ b/noise/test_chat.py @@ -143,7 +143,6 @@ def test_forward_ok(node_factory, executor): assert(m2['verified'] is True) -@pytest.mark.xfail(raises=concurrent.futures._base.TimeoutError) def test_read_tip(node_factory, executor): """Testcase for issue #331 https://github.com/lightningd/plugins/issues/331