spesmilo / electrum

Electrum Bitcoin Wallet
https://electrum.org
MIT License
7.46k stars 3.09k forks source link

AttributeError: 'mpz' object has no attribute 'to_bytes' #6068

Closed TARS-bot closed 4 years ago

TARS-bot commented 4 years ago

Crash Report

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

Traceback

  File "/usr/lib/python3.8/site-packages/electrum/gui/qt/main_window.py", line 553, in new_wallet
    self.gui_object.start_new_window(full_path, None)
  File "/usr/lib/python3.8/site-packages/electrum/gui/qt/__init__.py", line 215, in wrapper
    return func(self, *args, **kwargs)
  File "/usr/lib/python3.8/site-packages/electrum/gui/qt/__init__.py", line 239, in start_new_window
    wallet = self._start_wizard_to_select_or_create_wallet(path)
  File "/usr/lib/python3.8/site-packages/electrum/gui/qt/__init__.py", line 282, in _start_wizard_to_select_or_create_wallet
    storage = wizard.create_storage(path)
  File "/usr/lib/python3.8/site-packages/electrum/base_wizard.py", line 589, in create_storage
    storage.write()
  File "/usr/lib/python3.8/site-packages/electrum/util.py", line 356, in <lambda>
    return lambda *args, **kw_args: do_profile(args, kw_args)
  File "/usr/lib/python3.8/site-packages/electrum/util.py", line 352, in do_profile
    o = func(*args, **kw_args)
  File "/usr/lib/python3.8/site-packages/electrum/storage.py", line 89, in write
    self._write()
  File "/usr/lib/python3.8/site-packages/electrum/storage.py", line 98, in _write
    s = self.encrypt_before_writing(self.db.dump())
  File "/usr/lib/python3.8/site-packages/electrum/storage.py", line 196, in encrypt_before_writing
    s = public_key.encrypt_message(c, enc_magic)
  File "/usr/lib/python3.8/site-packages/electrum/ecc.py", line 286, in encrypt_message
    ecdh_key = (self * ephemeral.secret_scalar).get_public_key_bytes(compressed=True)
  File "/usr/lib/python3.8/site-packages/electrum/ecc.py", line 240, in __mul__
    ecdsa_point = self._pubkey.point * other
  File "/usr/lib/python3.8/site-packages/electrum/ecc_fast.py", line 125, in mul
    public_pair_bytes = b'\4' + self.x().to_bytes(32, byteorder="big") + self.y().to_bytes(32, byteorder="big")

AttributeError: 'mpz' object has no attribute 'to_bytes'

Reporter

This issue was reported by 1 user(s):

Electrum Version Python Version Operating System Wallet Type Locale Stack
3.3.8 3.8.2 (default, Feb 26 2020, 22:21:03) [GCC 9.2.1 20200130] Linux-5.5.13-1-MANJARO-x86_64-with-glibc2.2.5 standard ru_RU ℹ

Additional Information

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

SomberNight commented 4 years ago

This is a duplicate of https://github.com/spesmilo/electrum/issues/5927 Already fixed on master.

One workaround is to install older python-ecdsa:

python3 -m pip uninstall ecdsa
python3 -m pip install --user ecdsa<0.15