mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-03-26 20:30:59 +01:00
renepay: add a test for concurrent payments
This commit is contained in:
parent
1ee157f02b
commit
13a2828b12
1 changed files with 37 additions and 0 deletions
|
@ -13,6 +13,7 @@ import time
|
|||
import json
|
||||
import subprocess
|
||||
import os
|
||||
import re
|
||||
|
||||
|
||||
def test_simple(node_factory):
|
||||
|
@ -681,3 +682,39 @@ def test_htlcmax0(node_factory):
|
|||
l1.wait_for_htlcs()
|
||||
invoice = only_one(l6.rpc.listinvoices("inv")["invoices"])
|
||||
assert invoice["amount_received_msat"] >= Millisatoshi("600000sat")
|
||||
|
||||
|
||||
def test_concurrency(node_factory):
|
||||
l1, l2, l3 = node_factory.line_graph(3, wait_for_announce=True, opts=[{}, {}, {}])
|
||||
inv = l3.rpc.invoice("1000sat", "test_renepay", "description")["bolt11"]
|
||||
p1 = subprocess.Popen(
|
||||
[
|
||||
"cli/lightning-cli",
|
||||
"--network={}".format(TEST_NETWORK),
|
||||
"--lightning-dir={}".format(l1.daemon.lightning_dir),
|
||||
"-k",
|
||||
"renepay",
|
||||
"invstring={}".format(inv),
|
||||
],
|
||||
stdout=subprocess.PIPE,
|
||||
)
|
||||
# make several other spurious requests
|
||||
for i in range(4):
|
||||
subprocess.Popen(
|
||||
[
|
||||
"cli/lightning-cli",
|
||||
"--network={}".format(TEST_NETWORK),
|
||||
"--lightning-dir={}".format(l1.daemon.lightning_dir),
|
||||
"-k",
|
||||
"renepay",
|
||||
"invstring={}".format(inv),
|
||||
],
|
||||
stdout=subprocess.PIPE,
|
||||
)
|
||||
p1.wait(timeout=60)
|
||||
# remove comments from the output before parsing the json
|
||||
out1 = json.loads(re.sub("#.*?\n", "", p1.stdout.read().decode()))
|
||||
assert out1["status"] == "complete"
|
||||
assert out1["amount_msat"] == Millisatoshi("1000sat")
|
||||
invoice = only_one(l3.rpc.listinvoices("test_renepay")["invoices"])
|
||||
assert invoice["amount_received_msat"] >= Millisatoshi("1000sat")
|
||||
|
|
Loading…
Add table
Reference in a new issue