Backend: Unstuck outgoing payments (#857)
* first attempts * lndrest works * fix details * optional fee update * use base64.urlsafe_b64encode * return paymentstatus * CLN: return pending for pending invoices * grpc wip * lndgrpc works * cln: return pending for pending invoices really this time * retry wallet out of exception * wip eclair * take all routines into try except * cliche: return error * rename payment.check_pending() to payment.check_status() * rename payment.check_pending() to payment.check_status() * eclair: works * eclair: better error check * opennode: works * check payment.checking_id istead of payment.ok * payment.ok check as well * cln: works? * cln: works * lntxbot: works * lnbits/wallets/lnpay.py * cln: error handling * make format * lndhub full detail update * spark: wip * error to False * wallets: return clean PaymentResponse * opennode: strict error * cliche: works * lnbits: works * cln: dont throw error * preimage not error * fix cln * do not add duplicate payments * revert cln * extra safety for cln * undo crud changes until tests work * tasks: better logging and 0.5s sleep for regular status check * 0.1 s * check if wallet exists * lnbits unhashed description * remove sleep * revert app.py * cleanup * add check * clean error * readd app.py * fix eclaid
This commit is contained in:
@@ -100,7 +100,7 @@ class LNPayWallet(Wallet):
|
||||
)
|
||||
|
||||
if r.is_error:
|
||||
return PaymentResponse(False, None, 0, None, data["message"])
|
||||
return PaymentResponse(False, None, None, None, data["message"])
|
||||
|
||||
checking_id = data["lnTx"]["id"]
|
||||
fee_msat = 0
|
||||
@@ -113,15 +113,18 @@ class LNPayWallet(Wallet):
|
||||
async def get_payment_status(self, checking_id: str) -> PaymentStatus:
|
||||
async with httpx.AsyncClient() as client:
|
||||
r = await client.get(
|
||||
url=f"{self.endpoint}/lntx/{checking_id}?fields=settled",
|
||||
url=f"{self.endpoint}/lntx/{checking_id}",
|
||||
headers=self.auth,
|
||||
)
|
||||
|
||||
if r.is_error:
|
||||
return PaymentStatus(None)
|
||||
|
||||
data = r.json()
|
||||
preimage = data["payment_preimage"]
|
||||
fee_msat = data["fee_msat"]
|
||||
statuses = {0: None, 1: True, -1: False}
|
||||
return PaymentStatus(statuses[r.json()["settled"]])
|
||||
return PaymentStatus(statuses[data["settled"]], fee_msat, preimage)
|
||||
|
||||
async def paid_invoices_stream(self) -> AsyncGenerator[str, None]:
|
||||
self.queue: asyncio.Queue = asyncio.Queue(0)
|
||||
|
||||
Reference in New Issue
Block a user