-
Notifications
You must be signed in to change notification settings - Fork 990
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
[wallet] panic: 'attempt to subtract with overflow' when sending small quantities #396
Comments
Hmm - probably related to the fact we are (incorrectly) building the tx as "receiver pays the fee" when we should be "sender pays the fee" (related #274). |
I might have been hit by the same bug: https://hastebin.com/yujufatozu.rb I was trying to list my wallet outputs, the process crashed. |
The receiver tries to subtract fee from amount and the result becomes negative and overflow takes place. The problem is that fee is more than the amount. It is not matter of who subtracts fee. [test case] thread '' panicked at 'attempt to subtract with overflow', wallet/src/receiver.rs: fn receive_transaction For reference, the function to calculate fee is: const DEFAULT_BASE_FEE: u64 = consensus::MILLI_GRIN; /// Transaction fee calculation
} |
Until the issue #274 and how to do with amount less than fee w.r.t business requirement finalized, I propose a solution for this issue. When it receives amount less than calculated transaction fee, the receiver sends back error, such as "Error::MoreFeeThanAmount"??? |
Yes, an explicit error would already be a lot better. |
…ow' when sending small quantities #396 (#604) * Add 'sent' to wallet info output (#288) * Fund calculation inconsistent (#582) * [wallet] panic: 'attempt to subtract with overflow' when sending small quantities (#396) * [wallet] panic: 'attempt to subtract with overflow' when sending small quantities (#396)
Fixed by #694. |
wallet listener log: http://termbin.com/zmmi
I was trying to send a tiny quantity (1e-8 grins). Wallet send output:
The text was updated successfully, but these errors were encountered: