pytest: always provide payment_secret when making payments.

They're about to become compulsory.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2021-07-12 16:19:19 +09:30
committed by neil saitug
parent 3f5d5a1de5
commit 4e881e56ce
7 changed files with 212 additions and 164 deletions

View File

@@ -30,19 +30,20 @@ def test_single_hop(node_factory, executor):
fs = []
invoices = []
for i in tqdm(range(num_payments)):
invoices.append(l2.rpc.invoice(1000, 'invoice-%d' % (i), 'desc')['payment_hash'])
inv = l2.rpc.invoice(1000, 'invoice-%d' % (i), 'desc')
invoices.append((inv['payment_hash'], inv['payment_secret']))
route = l1.rpc.getroute(l2.rpc.getinfo()['id'], 1000, 1)['route']
print("Sending payments")
start_time = time()
def do_pay(i):
p = l1.rpc.sendpay(route, i)
def do_pay(i, s):
p = l1.rpc.sendpay(route, i, payment_secret=s)
r = l1.rpc.waitsendpay(p['payment_hash'])
return r
for i in invoices:
fs.append(executor.submit(do_pay, i))
for i, s in invoices:
fs.append(executor.submit(do_pay, i, s))
for f in tqdm(futures.as_completed(fs), total=len(fs)):
f.result()