rebalance: listpays use status argument

It is a performance improvement: `rebalancereport` running time changes from 40 secs to 14 secs on my node.
This commit is contained in:
Gálli Zoltán
2022-08-29 20:40:38 +02:00
committed by Michael Schmoock
parent e625369423
commit ce423836d6

View File

@@ -761,10 +761,7 @@ def rebalancereport(plugin: Plugin):
total_fee = Millisatoshi(0)
total_amount = Millisatoshi(0)
res["total_successful_rebalances"] = len(rebalances)
# pyln-client does not support the 'status' argument as yet
# pays = plugin.rpc.listpays(status="complete")["pays"]
pays = plugin.rpc.listpays()["pays"]
pays = [p for p in pays if p.get('status') == 'complete']
pays = plugin.rpc.listpays(status="complete")["pays"]
for r in rebalances:
try:
pay = next(p for p in pays if p["payment_hash"] == r["payment_hash"])