(node_factory, executor)
| 45 | |
| 46 | |
| 47 | def test_single_hop(node_factory, executor): |
| 48 | l1 = get_bench_node(node_factory) |
| 49 | l2 = get_bench_node(node_factory) |
| 50 | |
| 51 | l1.rpc.connect(l2.rpc.getinfo()['id'], 'localhost:%d' % l2.port) |
| 52 | l1.openchannel(l2, 4000000) |
| 53 | |
| 54 | print("Collecting invoices") |
| 55 | fs = [] |
| 56 | invoices = [] |
| 57 | for i in tqdm(range(num_payments)): |
| 58 | inv = l2.rpc.invoice(1000, 'invoice-%d' % (i), 'desc') |
| 59 | invoices.append((inv['payment_hash'], inv['payment_secret'])) |
| 60 | |
| 61 | route = l1.single_route(l2.rpc.getinfo()['id'], 1000) |
| 62 | print("Sending payments") |
| 63 | start_time = time() |
| 64 | |
| 65 | def do_pay(i, s): |
| 66 | p = l1.rpc.sendpay(route, i, payment_secret=s) |
| 67 | r = l1.rpc.waitsendpay(p['payment_hash']) |
| 68 | return r |
| 69 | |
| 70 | for i, s in invoices: |
| 71 | fs.append(executor.submit(do_pay, i, s)) |
| 72 | |
| 73 | for f in tqdm(futures.as_completed(fs), total=len(fs)): |
| 74 | f.result() |
| 75 | |
| 76 | diff = time() - start_time |
| 77 | print("Done. %d payments performed in %f seconds (%f payments per second)" % (num_payments, diff, num_payments / diff)) |
| 78 | |
| 79 | |
| 80 | def test_single_payment(node_factory, benchmark): |
nothing calls this directly
no test coverage detected