Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use DecimalAmount for errors and fix the equality for DecimalAmount #1469

Open
TheQuantumPhysicist opened this issue Jan 18, 2024 · 0 comments
Labels
UI User-interface related issues (whether GUI, CLI or otherwise) wallet Everything related to the node wallets (whether GUI or CLI)
Milestone

Comments

@TheQuantumPhysicist
Copy link
Collaborator

Currently, errors derived from thiserror (especially in the wallet) use Amount when errors occur. The problem with that is that the errors appear very unreadable for users, something in the form:

Wallet error: Wallet error: Coin selection error: Not enough funds got: Amount { val: 99999939400000 }, requested: Amount { val: 4000000014300000 }

We can use DecimalAmount instead, but the issue there is that it doesn't implement Eq or PartialEq because equality can be achieved even if the contents inside are not the same, where different amounts with different amounts of decimals can be equal.

We either fix this, or we create yet another type for amount errors that assumes equality is only for all equal.

@TheQuantumPhysicist TheQuantumPhysicist added UI User-interface related issues (whether GUI, CLI or otherwise) wallet Everything related to the node wallets (whether GUI or CLI) labels Jan 18, 2024
@TheQuantumPhysicist TheQuantumPhysicist added this to the Phase Alpha milestone Jan 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
UI User-interface related issues (whether GUI, CLI or otherwise) wallet Everything related to the node wallets (whether GUI or CLI)
Projects
None yet
Development

No branches or pull requests

1 participant