Issue NUT-08 overpaid Lightning fees for melt quote checks on startup (#688)

* startup: do not rollback unknown melt quote states

* fix: provide overpaid fees on startup

* fix: check if outputs in db

* fix test: expect melt quote pending if payment state is unknown

* fix up comment
This commit is contained in:
callebtc
2025-01-21 17:28:41 -06:00
committed by GitHub
parent 2f19485ad6
commit ad7c6b8e0b
8 changed files with 84 additions and 34 deletions

View File

@@ -287,6 +287,7 @@ class MeltQuote(LedgerEvent):
fee_paid: int = 0
payment_preimage: Optional[str] = None
expiry: Optional[int] = None
outputs: Optional[List[BlindedMessage]] = None
change: Optional[List[BlindedSignature]] = None
mint: Optional[str] = None
@@ -307,9 +308,13 @@ class MeltQuote(LedgerEvent):
# parse change from row as json
change = None
if row["change"]:
if "change" in row.keys() and row["change"]:
change = json.loads(row["change"])
outputs = None
if "outputs" in row.keys() and row["outputs"]:
outputs = json.loads(row["outputs"])
return cls(
quote=row["quote"],
method=row["method"],
@@ -322,6 +327,7 @@ class MeltQuote(LedgerEvent):
created_time=created_time,
paid_time=paid_time,
fee_paid=row["fee_paid"],
outputs=outputs,
change=change,
expiry=expiry,
payment_preimage=payment_preimage,