fix: load keyset keys from database to prevent duplicate insertions #1291
No reviewers
Labels
No labels
DB & Storage
Deployment
Error Handling & Logging
Maintenance
Payment Backend
backport
backport v0.13.x
backport v0.14.x
backport v0.15.x
bindings
blocked
bug
cdk-sql
ci
cli
deps
documentation
duplicate
enhancement
good first issue
help wanted
invalid
keep-open
ldk-node-ui
migrations
mint
mutation-testing
needs rebase
needs review
new nut
nut change
question
ready
rust-version
rustfmt
stacked hold
stale
testing
wallet
weekly-report
wontfix
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
cashubtc/cdk!1291
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "wallet_key_cache_duplicate"
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?
The wallet was failing on the second mint with "UNIQUE constraint failed: key.keyset_u32" because the MintMetadataCache never loaded keys from the database on startup. Every new process would re-fetch keys from the mint's HTTP API and try to insert them again, causing aconstraint violation. Fixed by loading existing keys from the database into the cache before fetching from HTTP (in both load_from_mint and load_auth). Checking if keys already exist before trying to insert them in persist_to_database. This eliminates the duplicate insertion errors and also saves bandwidth by not re-fetching keys we already have.
Description
Notes to the reviewers
Suggested CHANGELOG Updates
CHANGED
ADDED
REMOVED
FIXED
Checklist
just final-checkbefore committing