Skip to content

refactor: Replace operation log with event log for transaction history#433

Draft
joschisan wants to merge 1 commit intofedimint:masterfrom
joschisan:payment-events
Draft

refactor: Replace operation log with event log for transaction history#433
joschisan wants to merge 1 commit intofedimint:masterfrom
joschisan:payment-events

Conversation

@joschisan
Copy link
Copy Markdown

Context

The ecash-app reconstructs transaction history on-demand from Fedimint's operation log — a ~340-line function that parses operation metadata and outcomes. The conduit app uses Fedimint's event log (fedimint-eventlog) to persist payment events to a local DB and read them back. We want the same system here, keeping the existing Flutter interface (same Transaction type, same transactions() function, same MultimintEvent variants) completely unchanged.

Architecture

Event log as primary source, operation log for enrichment.

  • A background listener persists all payment events from the fedimint event log to local DB
  • transactions() reads from local event log DB instead of scanning the operation log
  • For the detail fields not in the event log (gateway, payment_hash, address, etc.), fall back to the operation log
  • MultimintEvent::Lightning/::Ecash still published for Flutter toast triggers
  • No Flutter changes at all

What's in the event log vs what needs the operation log

Available from event log:

  • operation_id, amount, fee, timestamp, direction, success/pending/failed
  • preimage (LNv2 SendPaymentUpdateEvent Success variant)
  • oob_notes (Mint SendPaymentEvent)
  • txid (Wallet SendPaymentStatusEvent Success, Wallet ReceivePaymentEvent)

Needs operation log enrichment (detail view only):

  • gateway, payment_hash, payee_pubkey, ln_address (Lightning)
  • address, fee_rate_sats_per_vb, tx_size_vb (On-chain)
  • input_fees, output_fees, dust (Ecash receive)

Changes

  • New events.rs — Ports conduit's event log parsing (ParsedPayment, ParsedEvent, parse_event_log_entry, apply_update). Handles LNv2, mint, and wallet events. LNv1 events structure-ready for next fedimint release.
  • db.rs — Adds EventLogEntryKey/EventLogEntryPrefix DB schema (prefix 0x15)
  • multimint.rs — Replaces spawn_lnv2_event_listener with spawn_event_log_listener (persists all events, publishes MultimintEvent for toasts). Rewrites transactions() to read from event log DB with operation log enrichment for detail fields.
  • lib.rs — Adds mod events;

🤖 Generated with Claude Code

@joschisan joschisan force-pushed the payment-events branch 8 times, most recently from 42bff60 to 969106f Compare April 6, 2026 10:25
Replace the on-demand operation log scanning in transactions() with
fedimint's event log system (same approach as conduit). A background
listener persists all payment events to a local DB, and transactions()
reads from there with operation log enrichment for detail fields.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant