From a44491fff0ccd7bde20661eecf88bf136db5f6e6 Mon Sep 17 00:00:00 2001 From: Christian Decker Date: Fri, 12 Oct 2018 15:02:58 +0200 Subject: [PATCH] benchmark: Add two benchmarks for forwarded payments We weren't benchmarking them, so do that now. --- tests/benchmark.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tests/benchmark.py b/tests/benchmark.py index b56eeca10..7c25be6de 100644 --- a/tests/benchmark.py +++ b/tests/benchmark.py @@ -61,6 +61,26 @@ def test_single_payment(node_factory, benchmark): benchmark(do_pay, l1, l2) +def test_forward_payment(node_factory, benchmark): + l1, l2, l3 = node_factory.line_graph(3, announce=True) + + def do_pay(src, dest): + invoice = dest.rpc.invoice(1000, 'invoice-{}'.format(random.random()), 'desc')['bolt11'] + src.rpc.pay(invoice) + + benchmark(do_pay, l1, l3) + + +def test_long_forward_payment(node_factory, benchmark): + nodes = node_factory.line_graph(21, announce=True) + + def do_pay(src, dest): + invoice = dest.rpc.invoice(1000, 'invoice-{}'.format(random.random()), 'desc')['bolt11'] + src.rpc.pay(invoice) + + benchmark(do_pay, nodes[0], nodes[-1]) + + def test_invoice(node_factory, benchmark): l1 = node_factory.get_node()