From 9d4cab980a67133ad0f62d2537c48d9abf22a58e Mon Sep 17 00:00:00 2001 From: callebtc <93376500+callebtc@users.noreply.github.com> Date: Sat, 2 Nov 2024 16:15:29 +0100 Subject: [PATCH] turn off melt lock by default --- cashu/core/settings.py | 1 + cashu/mint/ledger.py | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/cashu/core/settings.py b/cashu/core/settings.py index 8f305a23..dbc57c09 100644 --- a/cashu/core/settings.py +++ b/cashu/core/settings.py @@ -62,6 +62,7 @@ class MintSettings(CashuSettings): mint_max_secret_length: int = Field(default=512) mint_input_fee_ppk: int = Field(default=0) + mint_disable_melt_on_error: bool = Field(default=False) class MintDeprecationFlags(MintSettings): diff --git a/cashu/mint/ledger.py b/cashu/mint/ledger.py index c08531e2..5e4aa5b4 100644 --- a/cashu/mint/ledger.py +++ b/cashu/mint/ledger.py @@ -880,7 +880,7 @@ async def melt( Tuple[str, List[BlindedMessage]]: Proof of payment and signed outputs for returning overpaid fees to wallet. """ # make sure we're allowed to melt - if self.disable_melt: + if self.disable_melt and settings.mint_disable_melt_on_error: raise NotAllowedError("Melt is disabled. Please contact the operator.") # get melt quote and check if it was already paid @@ -976,7 +976,7 @@ async def melt( except Exception as e: # Something went wrong. We might have lost connection to the backend. Keep transaction pending and return. logger.error( - f"Lightning backend error: could not check payment status. Proofs for melt quote {melt_quote.quote} are stuck as PENDING. Disabling melt. Fix your Lightning backend and restart the mint.\nError: {e}" + f"Lightning backend error: could not check payment status. Proofs for melt quote {melt_quote.quote} are stuck as PENDING.\nError: {e}" ) self.disable_melt = True return PostMeltQuoteResponse.from_melt_quote(melt_quote) @@ -998,7 +998,7 @@ async def melt( case _: # Something went wrong with our implementation or the backend. Status check returned different result than payment. Keep transaction pending and return. logger.error( - f"Payment state is {status.result.name} and payment was {payment.result}. Proofs for melt quote {melt_quote.quote} are stuck as PENDING. Disabling melt. Fix your Lightning backend and restart the mint." + f"Payment state was {payment.result} but additional payment state check returned {status.result.name}. Proofs for melt quote {melt_quote.quote} are stuck as PENDING." ) self.disable_melt = True return PostMeltQuoteResponse.from_melt_quote(melt_quote)