feat: republish endpoints + polling + multi-ticket via N-rows model #16
1 changed files with 7 additions and 7 deletions
fix: every ticket row gets a fresh short-hash id (no payment_hash reuse)
Previous commit reused the LNbits invoice payment_hash as the first row's id, so a 3-ticket purchase ended up with one 64-hex id and two short-hash ids — inconsistent and noisy in My Tickets. Switch every row to urlsafe_short_hash. The shared payment_hash column is the join key for invoice lookups (poll endpoint, ws notifier, on_invoice_paid); rows never need to BE the payment hash, they only need to point at it. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
commit
7b761a1aef
14
views_api.py
14
views_api.py
|
|
@ -612,15 +612,15 @@ async def api_ticket_create(
|
||||||
extra=extra,
|
extra=extra,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
# Multi-ticket purchases land as N rows sharing the LNbits invoice
|
# Each row gets a fresh urlsafe_short_hash id so single- and
|
||||||
# payment_hash but with distinct `id`s — one independently
|
# multi-ticket purchases stay shape-consistent — every scannable
|
||||||
# scannable QR per attendee. The first row reuses payment_hash as
|
# ticket id is a short hash, never the long bolt11 payment_hash.
|
||||||
# its id so the legacy single-purchase invariant
|
# The shared `payment_hash` column is the join key for invoice
|
||||||
# (`id == payment_hash`) still holds for quantity == 1 callers.
|
# lookup (poll endpoint, ws notifier, set_ticket_paid loop).
|
||||||
ticket_ids: list[str] = []
|
ticket_ids: list[str] = []
|
||||||
sats_per_ticket = payment.sat // quantity if quantity else payment.sat
|
sats_per_ticket = payment.sat // quantity if quantity else payment.sat
|
||||||
for index in range(quantity):
|
for _ in range(quantity):
|
||||||
row_id = payment.payment_hash if index == 0 else urlsafe_short_hash()
|
row_id = urlsafe_short_hash()
|
||||||
await create_ticket(
|
await create_ticket(
|
||||||
payment_hash=payment.payment_hash,
|
payment_hash=payment.payment_hash,
|
||||||
wallet=event.wallet,
|
wallet=event.wallet,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue