Repository navigation
fix(wallet-db): keep the melt quote payment proof on updates without one (redb, supabase) - #2831
Merged
thesimplekid merged 3 commits intoNov 18, 2026
Conversation
The wallet updates a melt quote with whatever the mint's status response carries, and a response without a preimage set payment_proof to None. The SQL backend keeps the stored payment proof in that case (COALESCE in add_melt_quote), but redb wrote the incoming quote as is, so the proof of payment was lost.
add_melt_quote PATCHes the whole row, and a quote without a payment proof was sent as "payment_proof": null, which cleared the stored one. Leave the column out when it is None, as the SQL backend keeps it.
Contributor
Author
|
The red checks look unrelated to this change. Integration regtest Onchain tests (POSTGRES) panicked in the regtest harness before any test ran, at |
thesimplekid
approved these changes
Nov 18, 2026
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.
Description
On redb and Supabase wallets, a melt quote's stored payment proof (the preimage) is erased by a later quote update that doesn't carry one.
The wallet writes melt quotes back with whatever the mint's status response contains.
update_melt_quote_statesetsquote.payment_prooffromresponse.payment_preimage/response.outpointand callsadd_melt_quote. A response without a preimage (some backends and custom methods don't echo it, and later status checks of a paid quote can omit it) therefore setspayment_proof = None.The backends handle that update differently:
payment_proof = COALESCE(excluded.payment_proof, melt_quote.payment_proof), added in 3012af9.test_add_melt_quote_preserves_existing_payment_proof_when_update_has_nonein the melt saga covers it, but only against in-memory SQLite.Noneoverwrites the stored proof.MeltQuoteTable, which serialized"payment_proof": nulland cleared the column.Fix:
MeltQuoteTable::payment_proofis left out of the request body when it isNone. On INSERT that is the same asnull; on the update PATCH the stored value is kept.A new payment proof still replaces the stored one on every backend, as before.
Notes to the reviewers
add_melt_quote_keeps_payment_proof, registered inwallet_db_test!, so every backend runs it. It fails onmainfor redb (left: None, right: Some("preimage")) and passes for SQLite and Postgres.--features integration-tests. I also added a unit test (melt_quote_row_without_payment_proof_leaves_the_column_out) that checks the serialized row, so it is covered in normal CI.Suggested CHANGELOG Updates
CHANGED
ADDED
REMOVED
FIXED
Checklist
just quick-checkbefore committing (ran nightly rustfmt, clippy and the tests above instead)crates/cdk-ffi) (no API change)