cashubtc / cdk

Cashu Development Kit
MIT License
88 stars 45 forks source link

Mint: When melt fails there is an sql error attempting to add proofs #391

Open thesimplekid opened 1 month ago

thesimplekid commented 1 month ago

9639e6
2024-10-06T20:13:01.009989Z DEBUG melt:verify_melt_request: cdk::mint::melt: Verified melt quote: b27fe966-5afa-4967-9073-ebb50b869730
2024-10-06T20:13:01.147059Z ERROR melt: cdk_cln: Error attempting to pay invoice: 1e81fe1582cea3def64f6a8ea0dc36c65f2c620c38b478193ee2279e309639e6
2024-10-06T20:13:01.147194Z ERROR melt: cdk_cln: Err(RpcError { code: Some(210), message: "Ran out of routes to try after 1 attempt: see `paystatus`", data: None })
2024-10-06T20:13:01.147263Z ERROR melt: cdk::mint::melt: Error returned attempting to pay: b27fe966-5afa-4967-9073-ebb50b869730 Wrong CLN response
2024-10-06T20:13:01.148733Z  INFO melt: cdk::mint::melt: Lightning payment for quote b27fe966-5afa-4967-9073-ebb50b869730 failed.
2024-10-06T20:13:01.424414Z DEBUG process_swap_request: cdk_sqlite::mint: Attempting to add known proof. Skipping.... SQLX(Database(SqliteError { code: 1555, message: "UNIQUE constraint failed: proof.y" }))
crodas commented 1 month ago

Is the same proof being added twice? Either ON CONFLICT or UPSERT should be used instead.

I think that ON CONFLICT IGNORE, since errors are not fatal, but take my point with a grain of salt. I still have very little context for the project, but I'm learning more daily.