From a794e87edd6d653e31cb531aeac5a174a3587109 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Mon, 31 May 2021 12:07:30 +0930 Subject: [PATCH] pytest: test pay ordering. Signed-off-by: Rusty Russell --- tests/test_pay.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/test_pay.py b/tests/test_pay.py index 2223c92fe..5f75e0f0e 100644 --- a/tests/test_pay.py +++ b/tests/test_pay.py @@ -3498,6 +3498,20 @@ def test_listpays_ongoing_attempt(node_factory, bitcoind, executor): l1.rpc.listpays() +def test_listsendpays_and_listpays_order(node_factory): + """listsendpays should be in increasing id order, listpays in created_at""" + l1, l2 = node_factory.line_graph(2) + for i in range(5): + inv = l2.rpc.invoice(1000 - i, "test {}".format(i), "test")['bolt11'] + l1.rpc.pay(inv) + + ids = [p['id'] for p in l1.rpc.listsendpays()['payments']] + assert ids == sorted(ids) + + created_at = [p['created_at'] for p in l1.rpc.listpays()['pays']] + assert created_at == sorted(created_at) + + @pytest.mark.developer("needs use_shadow") def test_mpp_waitblockheight_routehint_conflict(node_factory, bitcoind, executor): '''