spesmilo / spesmilo/electrum

InvalidOperation: quantize result has too many digits for current context

Open
#7,129 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
8.6k
Forks
3.5k
Avg merge
2d 8h
Merged PRs (30d)
61

Description

Crash Report

This crash report was reported through the automatic crash reporting system 🤖

Traceback

  File "/usr/lib/python3.9/site-packages/electrum/gui/qt/main_window.py", line 881, in timer_actions
    self.update_wallet()
  File "/usr/lib/python3.9/site-packages/electrum/gui/qt/main_window.py", line 1004, in update_wallet
    self.update_tabs()
  File "/usr/lib/python3.9/site-packages/electrum/gui/qt/main_window.py", line 1012, in update_tabs
    self.request_list.update()
  File "/usr/lib/python3.9/site-packages/electrum/gui/qt/request_list.py", line 146, in update
    amount_str = self.parent.format_amount(amount) if amount else ""
  File "/usr/lib/python3.9/site-packages/electrum/gui/qt/main_window.py", line 892, in format_amount
    return self.config.format_amount(x, is_diff=is_diff, whitespaces=whitespaces)
  File "/usr/lib/python3.9/site-packages/electrum/simple_config.py", line 642, in format_amount
    return format_satoshis(
  File "/usr/lib/python3.9/site-packages/electrum/util.py", line 655, in format_satoshis
    x = Decimal(x).quantize(Decimal('1E-8'))
  File "/usr/lib/python3.9/_pydecimal.py", line 2573, in quantize
    return context._raise_error(InvalidOperation,
  File "/usr/lib/python3.9/_pydecimal.py", line 4044, in _raise_error
    raise error(explanation)

InvalidOperation: quantize result has too many digits for current context

Reporter

This issue was reported by 2 user(s):

Electrum Version Python Version Operating System Wallet Type Locale Stack
4.0.9 3.9.2 (default, Feb 20 2021, 18:40:11) [GCC 10.2.0] Linux-5.10.23-1-lts-x86_64-with-glibc2.33 standard en_US
4.1.2 3.9.5 (default, May 12 2021, 17:14:51) [GCC 10.2.0] Linux-5.12.3-arch1-1-x86_64-with-glibc2.33 standard en_US

Additional Information

The reporting user(s) did not provide additional information.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in electrum/util.py at format_satoshis, following the call chain from electrum/simple_config.py format_amount and electrum/gui/qt/main_window.py. Reproduce or inspect the request-list update path shown in the traceback, then verify that formatting the reported amount no longer raises Decimal InvalidOperation.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
desktop
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.