feat: show how much each module recovered in the transaction history - #587
Closed
FrankChinedu wants to merge 1 commit into
Closed
FrankChinedu wants to merge 1 commit into
FrankChinedu wants to merge 1 commit into
Conversation
A wallet restored from a seed phrase comes back with its balance but an empty transaction history: the operation log is local state no seed can reconstruct, so the recovered funds appear with nothing to account for them. Fedimint already logs a `ModuleRecoveryCompleted` event per module, with the recovered amount for modules that track one. This indexes those events into our own database and renders each as a history row. Rust: - `ModuleRecoveryKey`/`ModuleRecovery` persist one row per module, keyed by module instance so re-indexing is idempotent. - `spawn_recovery_event_indexer` scans the client event log from the start on every client open. Starting at zero rather than at the tip is what reads events written by the recovery client — which `wait_for_recovery` retires and replaces — and what backfills wallets that recovered before this existed. The event is `Persistent`, so it is never trimmed away. It is filtered on `entry.kind` because `ModuleRecoveryCompleted::MODULE` is `None`, leaving the module kind in the payload rather than on the entry. - `MultimintEvent::ModuleRecoveryComplete` is published only when the stored row changes, so the rescan on each open cannot re-announce a recovery that finished months ago. - `merge_recovery_rows` folds the rows into a page of the operation log. It sorts rather than appends, because `mintv2` recovers in `RecoveryMode::Usable` and ecash spent during a recovery predates the completion event; and it applies the operation log's own strict cursor bound, so a row the UI paged past is not handed back. Only the mint modules report an amount. The wallet module recovers but cannot price the outputs it finds, and `ln`/`lnv2` declare `RecoveryMode::None` and never recover, so the amount is optional throughout and an amount-less row renders as "—" rather than as zero. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
m1sterc001guy
force-pushed
the
feat/recovery-history
branch
from
October 5, 2026 11:56
99c3203 to
ee76580
Compare
Collaborator
|
Closing in favor of #591 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A wallet restored from a seed phrase comes back with its balance but an empty transaction history: the operation log is local state no seed can reconstruct, so the recovered funds appear with nothing to account for them.
Fedimint already logs a
ModuleRecoveryCompletedevent per module, with the recovered amount for modules that track one. This indexes those events into our own database and renders each as a history row.Rust:
ModuleRecoveryKey/ModuleRecoverypersist one row per module, keyed by module instance so re-indexing is idempotent.spawn_recovery_event_indexerscans the client event log from the start on every client open. Starting at zero rather than at the tip is what reads events written by the recovery client — whichwait_for_recoveryretires and replaces — and what backfills wallets that recovered before this existed. The event isPersistent, so it is never trimmed away. It is filtered onentry.kindbecauseModuleRecoveryCompleted::MODULEisNone, leaving the module kind in the payload rather than on the entry.MultimintEvent::ModuleRecoveryCompleteis published only when the stored row changes, so the rescan on each open cannot re-announce a recovery that finished months ago.merge_recovery_rowsfolds the rows into a page of the operation log. It sorts rather than appends, becausemintv2recovers inRecoveryMode::Usableand ecash spent during a recovery predates the completion event; and it applies the operation log's own strict cursor bound, so a row the UI paged past is not handed back.Only the mint modules report an amount. The wallet module recovers but cannot price the outputs it finds, and
ln/lnv2declareRecoveryMode::Noneand never recover, so the amount is optional throughout and an amount-less row renders as "—" rather than as zero.