mirror of
https://github.com/aljazceru/nutshell.git
synced 2025-12-24 03:54:21 +01:00
Mint: Recover pending melts at startup (#499)
* wip works with fakewallet * startup refactor * add tests * regtest tests for pending melts * wip CLN * remove db migration * remove foreign key relation to keyset id * fix: get_promise from db and restore DLEQs * test: check for keyset not found error * fix migrations * lower-case all db column names * add more tests for regtest * simlate failure for lightning * test wallet spent state with hodl invoices * retry * regtest with postgres * retry postgres * add sleeps * longer sleep on github * more sleep for github sigh * increase sleep ffs * add sleep loop * try something * do not pay with wallet but with ledger * fix lnbits pending state * fix pipeline to use fake admin from docker
This commit is contained in:
@@ -247,17 +247,21 @@ class CoreLightningRestWallet(LightningBackend):
|
||||
r.raise_for_status()
|
||||
data = r.json()
|
||||
|
||||
if r.is_error or "error" in data or not data.get("pays"):
|
||||
raise Exception("error in corelightning-rest response")
|
||||
if not data.get("pays"):
|
||||
# payment not found
|
||||
logger.error(f"payment not found: {data.get('pays')}")
|
||||
raise Exception("payment not found")
|
||||
|
||||
if r.is_error or "error" in data:
|
||||
message = data.get("error") or data
|
||||
raise Exception(f"error in corelightning-rest response: {message}")
|
||||
|
||||
pay = data["pays"][0]
|
||||
|
||||
fee_msat, preimage = None, None
|
||||
if self.statuses[pay["status"]]:
|
||||
# cut off "msat" and convert to int
|
||||
fee_msat = -int(pay["amount_sent_msat"][:-4]) - int(
|
||||
pay["amount_msat"][:-4]
|
||||
)
|
||||
fee_msat = -int(pay["amount_sent_msat"]) - int(pay["amount_msat"])
|
||||
preimage = pay["preimage"]
|
||||
|
||||
return PaymentStatus(
|
||||
|
||||
Reference in New Issue
Block a user