get_full_history: division by zero
Open
Nobody has claimed this yet.
bug 🐞
- Dominant language
- Python
- Stars
- 8.6k
- Forks
- 3.5k
- Avg merge
- 2d 8h
- Merged PRs (30d)
- 61
Description
On git master 553993b4d01605d5d745e142c64561c31c342051.
Traceback (most recent call last):
File "...\electrum\gui\qt\__init__.py", line 217, in start_new_window
w = self.create_window_for_wallet(wallet)
File "...\electrum\gui\qt\__init__.py", line 179, in create_window_for_wallet
w = ElectrumWindow(self, wallet)
File "...\electrum\gui\qt\main_window.py", line 199, in __init__
self.load_wallet(wallet)
File "...\electrum\lib\util.py", line 288, in <lambda>
return lambda *args, **kw_args: do_profile(func, args, kw_args)
File "...\electrum\lib\util.py", line 284, in do_profile
o = func(*args, **kw_args)
File "...\electrum\gui\qt\main_window.py", line 342, in load_wallet
self.history_list.update()
File "...\electrum\gui\qt\util.py", line 499, in update
self.on_update()
File "...\electrum\lib\util.py", line 288, in <lambda>
return lambda *args, **kw_args: do_profile(func, args, kw_args)
File "...\electrum\lib\util.py", line 284, in do_profile
o = func(*args, **kw_args)
File "...\electrum\gui\qt\history_list.py", line 215, in on_update
r = self.wallet.get_full_history(domain=self.get_domain(), from_timestamp=self.start_timestamp, to_timestamp=self.end_timestamp, fx=fx)
File "...\electrum\lib\util.py", line 288, in <lambda>
return lambda *args, **kw_args: do_profile(func, args, kw_args)
File "...\electrum\lib\util.py", line 284, in do_profile
o = func(*args, **kw_args)
File "...\electrum\lib\wallet.py", line 1043, in get_full_history
acquisition_price = - value / Decimal(COIN) * self.average_price(tx_hash, fx.timestamp_rate, fx.ccy)
File "...\electrum\lib\wallet.py", line 1753, in average_price
return total_price / (input_value/Decimal(COIN))
decimal.InvalidOperation: [<class 'decimal.DivisionUndefined'>]
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in lib/wallet.py at get_full_history and average_price, using the traceback and the GUI history-loading path as the entry point. Reproduce the failure while opening the wallet history, then inspect the zero-value calculation and add coverage for the affected case. Done means history loads without decimal.InvalidOperation and the regression is tested.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100