spesmilo / electrum

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

Crash after cancelling "Show on Trezor" dialog on MacOS #6188

Open leshik opened 4 years ago

leshik commented 4 years ago

After clicking an eye icon next to the "Receiving address", the dialog pops up saying "Confirm wallet address on your Trezor device" (and Trezor asks for confirmation). After clicking "Cancel", instead of confirming on the device, Electrum shows "An Error Occured" dialog, with the traceback like this:

Traceback
Traceback (most recent call last):
  File "trezorlib/client.py", line 140, in cancel
  File "trezorlib/client.py", line 149, in _raw_write
  File "trezorlib/transport/bridge.py", line 164, in write
  File "trezorlib/transport/bridge.py", line 68, in write_buf
  File "trezorlib/transport/bridge.py", line 132, in _call
  File "trezorlib/transport/bridge.py", line 45, in call_bridge
trezorlib.transport.TransportException: trezord: post/19 failed with code 400: other call in progress

Additional information
Electrum version: 3.3.8 
Python version: 3.6.4 (default, Feb 28 2018, 03:24:19) [GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)] 
Operating system: Darwin-19.5.0-x86_64-i386-64bit 
Wallet type: standard 
Locale: en_US 
ecdsa commented 4 years ago

could you try with git master?

leshik commented 4 years ago

@ecdsa doesn't matter, same error:

Traceback
Traceback (most recent call last):
  File "/Users/leshik/.pyenv/versions/3.8.2/lib/python3.8/site-packages/trezorlib/client.py", line 109, in cancel
    self._raw_write(messages.Cancel())
  File "/Users/leshik/.pyenv/versions/3.8.2/lib/python3.8/site-packages/trezorlib/client.py", line 129, in _raw_write
    self.transport.write(msg_type, msg_bytes)
  File "/Users/leshik/.pyenv/versions/3.8.2/lib/python3.8/site-packages/trezorlib/transport/bridge.py", line 159, in write
    self.handle.write_buf(header + message_data)
  File "/Users/leshik/.pyenv/versions/3.8.2/lib/python3.8/site-packages/trezorlib/transport/bridge.py", line 68, in write_buf
    self.transport._call("post", data=buf.hex())
  File "/Users/leshik/.pyenv/versions/3.8.2/lib/python3.8/site-packages/trezorlib/transport/bridge.py", line 135, in _call
    return call_bridge(uri, data=data)
  File "/Users/leshik/.pyenv/versions/3.8.2/lib/python3.8/site-packages/trezorlib/transport/bridge.py", line 44, in call_bridge
    raise TransportException(error_str)
trezorlib.transport.TransportException: trezord: post/29 failed with code 400: other call in progress

Additional information
Electrum version: 4.0.0a0 
Python version: 3.8.2 (default, Apr 13 2020, 20:32:29) [Clang 11.0.3 (clang-1103.0.32.29)] 
Operating system: macOS-10.15.5-x86_64-i386-64bit 
Wallet type: standard 
Locale: en_US 
SomberNight commented 4 years ago

maybe duplicate of https://github.com/spesmilo/electrum/issues/5144

prusnak commented 4 years ago

@leshik Don't you have a web wallet open at the same time by any chance?

leshik commented 4 years ago

@prusnak absolutely not. Tried this many times, it reproduces 100%.

prusnak commented 4 years ago

I cannot reproduce this with Electrum 4.0.0b0 running on Linux :-(

leshik commented 4 years ago

@prusnak I still see the same error with 4.0.0b0, but I'm on macOS. My trezor python library version is 0.12.0. Could it somehow be related to the way USB works on macs?

prusnak commented 4 years ago

Could it somehow be related to the way USB works on macs?

Most probably.

leshik commented 4 years ago

Most probably.

@prusnak How can I help you troubleshooting this issue? Maybe turn on debug logging in python trezor lib somehow?

prusnak commented 4 years ago

@leshik If you turn off the bridge (and python-trezor needs to use hidapi directly, not via a bridge) - does everything work just fine?

leshik commented 4 years ago

@prusnak yes, works like a charm. Is there still any reason to have trezor bridge installed? Does it exist only for compatibility reasons with Safari & Firefox?

prusnak commented 4 years ago

Yes. Bridge is needed only for browser that do not support WebUSB such as Firefox and Safari. Electrum and Chrome-based browsers can communicate with devices directly via WebUSB.