diff --git a/lnbits/core/models/payments.py b/lnbits/core/models/payments.py index 7ed99d71..122f72aa 100644 --- a/lnbits/core/models/payments.py +++ b/lnbits/core/models/payments.py @@ -198,7 +198,7 @@ class CreateInvoice(BaseModel): internal: bool = False out: bool = True amount: float = Query(None, ge=0) - memo: str | None = None + memo: str | None = Query(None, max_length=640) description_hash: str | None = None unhashed_description: str | None = None expiry: int | None = None diff --git a/lnbits/core/services/payments.py b/lnbits/core/services/payments.py index bdc96801..8ec0612c 100644 --- a/lnbits/core/services/payments.py +++ b/lnbits/core/services/payments.py @@ -108,7 +108,7 @@ async def create_invoice( if not user_wallet: raise InvoiceError(f"Could not fetch wallet '{wallet_id}'.", status="failed") - invoice_memo = None if description_hash else memo + invoice_memo = None if description_hash else memo[:640] # use the fake wallet if the invoice is for internal use only funding_source = fake_wallet if internal else get_funding_source()