Proxy wallet: sweep quotes across per-epoch currency units #17
Labels
No labels
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
vnprc/hashpool#17
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Teach the proxy's wallet to sweep quotes across per-epoch currency units — after the first rotation it would otherwise silently ignore every new-epoch quote forever. Verified: no CDK changes needed. Design:
docs/EPOCH_DESIGN.md(proxy wallet section).Primary goals:
retain(unit == self.unit)inget_unissued_mint_quotesis the single choke point). Lazily create a cheap handle per discovered unit — construction writes nothing — all sharing the one localstore, one seed, and one keyset metadata cache; run the existing sweep body once per unit. Verified safe: wallet schema and NUT-13 keyset counters are unit- or keyset-scoped.Current state and specifics
The single wallet is constructed with hardcoded unit
hashinroles/translator/src/lib/payment/wallet.rsand shared by the sweeper, faucet, and an inert notification handler. The sweep loop (roles/translator/src/lib/payment/quote_sweeper.rs) fetches by pubkey (unit-agnostic, persists all units), then filters to the constructed unit — foreign-unit quotes accumulate unminted with no error.batch_mintkeeps the P2PK spending conditions; CDK'sWalletRepositorycan serve as the unit→handle map (correct get-or-create locking) but its aggregate sweep is unusable here (drops spending conditions, per-quote HTTP), so use it as a container only, if at all.Witness
On the dev stack with #16's manual lever: rotate mid-mining; the sweeper mints quotes from both the old and new unit on the next passes; per-unit reconcile log shows both units converging to zero unissued; faucet and web UI stay functional.
Scope
In: translator payment module only. Out: reorg awareness (unpaid quotes never reach the wallet, by design), epoch-aware balance display, cashu.me fork changes.
Part of #13. Gated on #16 (needs a second unit to exist to be testable end to end).