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

grin-wallet crashes when attempting to send amount larger than balance #582

Closed
nthrow opened this issue Jan 26, 2021 · 1 comment · Fixed by #600
Closed

grin-wallet crashes when attempting to send amount larger than balance #582

nthrow opened this issue Jan 26, 2021 · 1 comment · Fixed by #600
Assignees
Labels
bug Something isn't working

Comments

@nthrow
Copy link

nthrow commented Jan 26, 2021

Describe the bug
When attempting to send an amount larger than the wallet's current balance, grin-wallet will panick and exit ungracefully.

To Reproduce

Password:
20210126 18:08:18.953 WARN grin_wallet_libwallet::api_impl::owner_updater - Scanning - 0% complete
20210126 18:08:19.183 WARN grin_wallet_libwallet::api_impl::owner_updater - Scanning - 99% complete
20210126 18:08:19.198 WARN grin_wallet_libwallet::api_impl::owner_updater - Scanning - 99% complete
20210126 18:08:19.199 WARN grin_wallet_libwallet::api_impl::owner_updater - Scanning Complete

____ Wallet Summary Info - Account 'default' as of height 1063713 ____

 Confirmed Total                  | 220.059956334
 Awaiting Confirmation (< 10)     | 0.000000000
 Awaiting Finalization            | 0.000000000
 Locked by previous transaction   | 0.000000000
 -------------------------------- | -------------
 Currently Spendable              | 220.059956334

Command 'info' completed successfully
nthrow@debian:~$ grin-wallet send -e -m 220
Password:

Estimation for sending 220.000000000:

+--------------------+-------------+----------------+
| Selection strategy | Fee         | Will be locked |
+====================+=============+================+
| smallest           | 0.023000000 | 220.059956334  |
+--------------------+-------------+----------------+
| all                | 0.023000000 | 220.059956334  |
+--------------------+-------------+----------------+

Command 'send' completed successfully
nthrow@debian:~$ grin-wallet send -e -m 220.5                                                                                                                                                                                                                                                                                                                                                           
Password:
20210126 18:08:33.539 ERROR grin_util::logger -
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Error { inner:

Not enough funds. Required: 220.512500000, Available: 220.059956334 }': /home/vsts/work/1/s/controller/src/command.rs:294   0: grin_util::logger::send_panic_to_log::{{closure}}
   1: std::panicking::rust_panic_with_hook
             at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/std/src/panicking.rs:597
   2: std::panicking::begin_panic_handler::{{closure}}
             at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/std/src/panicking.rs:499
   3: std::sys_common::backtrace::__rust_end_short_backtrace
             at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/std/src/sys_common/backtrace.rs:141
   4: rust_begin_unwind
             at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/std/src/panicking.rs:495
   5: core::panicking::panic_fmt
             at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/core/src/panicking.rs:92
   6: core::option::expect_none_failed
             at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/core/src/option.rs:1268
   7: grin_wallet_controller::command::send::{{closure}}::{{closure}}
   8: <core::iter::adapters::Map<I,F> as core::iter::traits::iterator::Iterator>::fold
   9: grin_wallet_controller::command::send::{{closure}}
  10: grin_wallet_controller::controller::owner_single_use
  11: grin_wallet_controller::command::send
  12: grin_wallet::cmd::wallet_args::parse_and_execute
  13: grin_wallet::cmd::wallet_args::wallet_command
  14: grin_wallet::cmd::wallet::wallet_command
  15: grin_wallet::real_main
  16: grin_wallet::main
  17: std::sys_common::backtrace::__rust_begin_short_backtrace
  18: std::rt::lang_start::{{closure}}
  19: core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once
             at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/core/src/ops/function.rs:259
      std::panicking::try::do_call
             at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/std/src/panicking.rs:381
      std::panicking::try
             at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/std/src/panicking.rs:345
      std::panic::catch_unwind
             at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/std/src/panic.rs:396
      std::rt::lang_start_internal
             at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/std/src/rt.rs:51
  20: main
  21: __libc_start_main
  22: _start



Thread 'main' panicked with message:
"called `Result::unwrap()` on an `Err` value: Error { inner:

Not enough funds. Required: 220.512500000, Available: 220.059956334 }"
See /home/nthrow/.grin/main/grin-wallet.log for further details.

Expected behavior
A graceful response, such as a message saying "Not enough funds!" or whatever. Also, the ability to "send all" or "send max" with auto-calculation of fees would be amazing, as I found this bug in trying to do as much manually.

Desktop (please complete the following information):

PRETTY_NAME="Debian GNU/Linux 10 (buster)"
NAME="Debian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
@jaspervdm jaspervdm added the bug Something isn't working label Jan 27, 2021
@jaspervdm jaspervdm self-assigned this Jan 27, 2021
@jaspervdm
Copy link
Contributor

I agree, it would be nicer to have a clean error message instead of a panic. Thanks for reporting

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants