Error message improvement: The error message ("Unit mismatch") when a swap results in zero outputs, which can happen due to fees, isn't very helpful #1356

Closed
opened 2025-11-29 20:29:48 +00:00 by SatsAndSports · 2 comments
SatsAndSports commented 2025-11-29 20:29:48 +00:00 (Migrated from github.com)

If you call receive_proofs on a Wallet with just a single-sat proof and the fees are non-zero, then the swap is basically impossible because it will try to do a swap with zero outputs

The wallet currently does attempt that swap, and the error message from the mint says there is a Unit mismatch. This is because verify_outputs in mint/verification.rs:180 returns Verification { amount: Amount::ZERO, unit: None, }.

Maybe the wallet should refuse to send a zero-output swap, and give a useful error message instead?

If you call `receive_proofs` on a `Wallet` with just a single-sat proof and the fees are non-zero, then the swap is basically impossible because it will try to do a swap with zero outputs The wallet currently does attempt that swap, and the error message from the mint says there is a Unit mismatch. This is because `verify_outputs` in `mint/verification.rs:180` returns `Verification { amount: Amount::ZERO, unit: None, }`. Maybe the wallet should refuse to send a zero-output swap, and give a useful error message instead?
SatsAndSports commented 2025-11-29 20:30:01 +00:00 (Migrated from github.com)

One possibility is to include something like this in wallet/swap.rs:

Image
One possibility is to include something like this in `wallet/swap.rs`: <img width="1674" height="436" alt="Image" src="https://github.com/user-attachments/assets/165af4e3-c65e-40f2-a530-72d318d08092" />
thesimplekid commented 2025-11-30 16:26:56 +00:00 (Migrated from github.com)

Yeah I noticed this as well (https://github.com/cashubtc/cdk/issues/1319). Im going to look into this this week

Yeah I noticed this as well (https://github.com/cashubtc/cdk/issues/1319). Im going to look into this this week
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
cashubtc/cdk#1356
No description provided.