Electron-cash: Electron Cash fails to parse some transactions (more inside)

Created on 4 Apr 2019  路  13Comments  路  Source: Electron-Cash/Electron-Cash

Crash Report

This crash report was reported through the automatic crash reporting system 馃

Traceback

```Python traceback
File "/home/hoenicke/.local/lib/python3.6/site-packages/electroncash/util.py", line 722, in run_with_except_hook
run_original(args2, *kwargs2)
File "/home/hoenicke/.local/lib/python3.6/site-packages/electroncash/network.py", line 1398, in run
self.wait_on_sockets()
File "/home/hoenicke/.local/lib/python3.6/site-packages/electroncash/network.py", line 1372, in wait_on_sockets
self.process_responses(interface)
File "/home/hoenicke/.local/lib/python3.6/site-packages/electroncash/network.py", line 801, in process_responses
self.process_response(interface, request, response, callbacks)
File "/home/hoenicke/.local/lib/python3.6/site-packages/electroncash/network.py", line 746, in process_response
callback(response)
File "/home/hoenicke/.local/lib/python3.6/site-packages/electroncash/synchronizer.py", line 185, in tx_response
traceback.print_exc()
File "/usr/lib/python3.6/traceback.py", line 163, in print_exc
print_exception(*sys.exc_info(), limit=limit, file=file, chain=chain)
File "/usr/lib/python3.6/traceback.py", line 105, in print_exception
print(line, file=file, end="")

OSError: [Errno 5] Eingabe-/Ausgabefehler
```

Reporter

This issue was reported by 5 user(s):

| Electron Cash Version | Python Version | Operating System | Wallet Type | Locale |
|---|---|---|---|---|
| 4.0.1 | 3.6.7 (default, Oct 22 2018, 11:32:17) [GCC 8.2.0] | Linux-4.15.0-46-generic-x86_64-with-Ubuntu-18.04-bionic | standard | de_DE |
| 4.0.7 | 3.6.8 (default, Jun 28 2018, 19:01:02) [GCC 4.8.4] | Linux-4.4.0-151-generic-x86_64-with-debian-stretch-sid | standard | tr_TR |
| 4.0.14 | 3.8.2 (default, Apr 1 2020, 15:52:55) [GCC 9.3.0] | Linux-5.4.35-0c418786-x86_64-with-glibc2.29 | standard | en_US |
| 4.2.0 | 3.6.9 (default, Jun 28 2018, 19:01:02) [GCC 5.4.0 20160609] | Linux-5.8.0-3-amd64-x86_64-with-debian-bullseye-sid | standard | es_ES |
| 4.2.0 | 3.6.9 (default, Jun 28 2018, 19:01:02) [GCC 5.4.0 20160609] | Linux-5.8.0-3-amd64-x86_64-with-debian-bullseye-sid | standard | es_ES |

Additional Information

Dear Prof. Venkman,

this error happens when I recover my old wallet with ElectronCash. It's probably a transaction with a non-standard script, maybe from this address: 3MaB7QVq3k4pQx3BhsvEADgzQonLSBwMdj


Tried to install the FlipStarter plugin (version 1.2).
ElectronCash is "installed" by simply running the extracted tar ball.


bug partially fixed

Most helpful comment

OK fix is up -- I'd note that if you make a watching-only wallet for 3MaB7QVq3k4pQx3BhsvEADgzQonLSBwMdj , the balance is completely wrong because the old electrum code doesn't properly detect spends from P2SH addresses unless they are very simple multisigs being spent in a very simple way. See #895 and spesmilo#4405 .

But at least it doesn't crash...

All 13 comments

File "/home/hoenicke/.local/lib/python3.6/site-packages/electroncash/util.py",

okay staying anonymous doesn't work :)

I think it is actually this transaction: 1c671eb25a20aaff28b2fa4254003c201155b54c73ac7cf9c309d835deed85ee

The parent is a one-of-two multisig transaction, which was used by counterparty to encode extra token data.

Ha ok -- let me investigate this. Was this your crash, @jhoenicke .. or are you just pitching it to diagnose?

Hmm I got it as this tx: 08e1026eaf044127d7103415570afd564dfac3131d7a5e4b645f591cd349bb2c

Definitely is a bug. Looking into it now..

@markblundeberg I need your help here. The txid is the one above. This ends up in EC as a redeemScript that looks like bytearray(b'\x91') (Which I can't figure out why?!) -- this is on the third input (input index 2).

The exceptions is triggered here:

https://github.com/Electron-Cash/Electron-Cash/blob/d20caa9286a9da7a96c1d3e773ff219026a970fb/lib/transaction.py#L288

The 'ops' for that input end up looking like (145, None, 1)

I can't tell what's going on because I really am not a super uber guy with bitcoin transaction internal representation.. whereas you are.

If you can help out -- could use your help here!

Update: 1c671eb25a20aaff28b2fa4254003c201155b54c73ac7cf9c309d835deed85ee (the one @jhoenicke pasted) also fails:

** PARSE INPUT
0
*** script:
bytearray(b'0E\x02!\x00\x86J\xa8J`\x0b\xd0z/X\xc7*\x0b\x07H9 !\x13\xf1\xc8\x05%Ss|\xa1\xf5\xeb/Mt\x02 \x1a{\xca\xbfZl=\xd2\xf0\t\xe5\x89\x9b\x1c\x81K\x0c|\x14\xc0\x9a\xc3^\xdc\x11\x0f\xfb\t|~#\xf6\x01')
** ops:
[(48, bytearray(b'E\x02!\x00\x86J\xa8J`\x0b\xd0z/X\xc7*\x0b\x07H9 !\x13\xf1\xc8\x05%Ss|\xa1\xf5\xeb/Mt\x02 \x1a{\xca\xbfZl=\xd2\xf0\t'), 49), (229, None, 50), (137, None, 51), (155, None, 52), (28, bytearray(b'\x81K\x0c|\x14\xc0\x9a\xc3^\xdc\x11\x0f\xfb\t|~#\xf6\x01'), 81)]

Clearly we have limitations in our ability to parse tx's and I am not sure why or what to do about it as this is beyond my knowledge of bitcoin.

OK fix is up -- I'd note that if you make a watching-only wallet for 3MaB7QVq3k4pQx3BhsvEADgzQonLSBwMdj , the balance is completely wrong because the old electrum code doesn't properly detect spends from P2SH addresses unless they are very simple multisigs being spent in a very simple way. See #895 and spesmilo#4405 .

But at least it doesn't crash...

@jhoenicke So it turns out Electron Cash has the same limitation Electrum does -- for performance reasons we really can't tell what the originating address is and we "guess" based on the redeem script. This works mostly but for some smart contracts and other things it fails spectacularly.

Electrum already plugged these exception gaps and just shows "unknown address" or nothing.

We just plugged it now in the latest commit -- behavior is as electrum. Tx verifies, balance is ok balance is NOT ok (see #895) -- but if you open up the tx there's no real indication where it came from. It is what it is.

The alternative would be to cache and/or download all input (prevou_hash) tx's -- which is something we want to do as an optional UI thing where the user clicks a button and it can then actually calculate the fee.

But for your average tx this would be overkill as a tx may potentially have hundreds of inputs. It would choke the client and/or the electrum servers.

So.. it is what it is. Thanks for reporting !!

and Thanks to @markblundeberg for figuring this out. :)

Correction. Balance is out of whack. Related: #895

Good afternoon @cculianu,

I just received another crash report related to this issue. The crash occured on Electron Cash 4.0.7.
I'm not sure which versions of Electron Cash include the fix but this is the first report from anything
newer than 4.0.1 since you closed the issue.

Could you please check if this issue really is resolved? Here is the traceback that I just collected:

```Python traceback
File "/tmp/.mount_ElectrLu5gcK/usr/lib/python3.6/site-packages/electroncash_gui/qt/external_plugins_window.py", line 246, in on_install
self.plugin_dialog.install_plugin_confirmed(self.plugin_path)
File "/tmp/.mount_ElectrLu5gcK/usr/lib/python3.6/site-packages/electroncash_gui/qt/external_plugins_window.py", line 348, in install_plugin_confirmed
run_hook('init_qt', self.main_window.gui_object)
File "/tmp/.mount_ElectrLu5gcK/usr/lib/python3.6/site-packages/electroncash/plugins.py", line 498, in run_hook
traceback.print_exc(file=sys.stdout)
File "/tmp/.mount_ElectrLu5gcK/usr/lib/python3.6/traceback.py", line 163, in print_exc
print_exception(*sys.exc_info(), limit=limit, file=file, chain=chain)
File "/tmp/.mount_ElectrLu5gcK/usr/lib/python3.6/traceback.py", line 105, in print_exception
print(line, file=file, end="")

OSError: [Errno 5] Girdi/脟谋kt谋 hatas谋
```

~ _With robotic wishes_

Good afternoon @cculianu,

I just received another crash report related to this issue. The crash occured on Electron Cash 4.0.7.
I'm not sure which versions of Electron Cash include the fix but this is the first report from anything
newer than 4.0.1 since you closed the issue.

Could you please check if this issue really is resolved? Here is the traceback that I just collected:

  File "/tmp/.mount_ElectrLu5gcK/usr/lib/python3.6/site-packages/electroncash_gui/qt/external_plugins_window.py", line 246, in on_install
    self.plugin_dialog.install_plugin_confirmed(self.plugin_path)
  File "/tmp/.mount_ElectrLu5gcK/usr/lib/python3.6/site-packages/electroncash_gui/qt/external_plugins_window.py", line 348, in install_plugin_confirmed
    run_hook('init_qt', self.main_window.gui_object)
  File "/tmp/.mount_ElectrLu5gcK/usr/lib/python3.6/site-packages/electroncash/plugins.py", line 498, in run_hook
    traceback.print_exc(file=sys.stdout)
  File "/tmp/.mount_ElectrLu5gcK/usr/lib/python3.6/traceback.py", line 163, in print_exc
    print_exception(*sys.exc_info(), limit=limit, file=file, chain=chain)
  File "/tmp/.mount_ElectrLu5gcK/usr/lib/python3.6/traceback.py", line 105, in print_exception
    print(line, file=file, end="")

OSError: [Errno 5] Girdi/脟谋kt谋 hatas谋

~ _With robotic wishes_

This seems to be unrelated to this issue and the text translates to I/O error, so I'd guess this is a hardware issue.

Aye, that's probably right. Or the plugin he/she was trying to load did something strange .. it was an external plugin that was being loaded.

Good morning @cculianu,

I just received another crash report related to this issue. The crash occured on Electron Cash 4.0.14.
I'm not sure which versions of Electron Cash include the fix but this is the first report from anything
newer than 4.0.7 since you closed the issue.

Could you please check if this issue really is resolved? Here is the traceback that I just collected:

```Python traceback
File "/home/jonas/electroncash/Electron-Cash-4.0.14/gui/qt/external_plugins_window.py", line 247, in on_install
self.plugin_dialog.install_plugin_confirmed(self.plugin_path)
File "/home/jonas/electroncash/Electron-Cash-4.0.14/gui/qt/external_plugins_window.py", line 345, in install_plugin_confirmed
result_code = plugin_manager.install_external_plugin(plugin_archive_path)
File "/home/jonas/electroncash/Electron-Cash-4.0.14/lib/plugins.py", line 460, in install_external_plugin
traceback.print_exc(file=sys.stdout)
File "/usr/lib/python3.8/traceback.py", line 163, in print_exc
print_exception(*sys.exc_info(), limit=limit, file=file, chain=chain)
File "/usr/lib/python3.8/traceback.py", line 105, in print_exception
print(line, file=file, end="")

OSError: [Errno 5] Input/output error
```

~ _With robotic wishes_

Good evening @cculianu,

I just received another crash report related to this issue. The crash occured on Electron Cash 4.2.0.
I'm not sure which versions of Electron Cash include the fix but this is the first report from anything
newer than 4.0.14 since you closed the issue.

Could you please check if this issue really is resolved? Here is the traceback that I just collected:

```Python traceback
File "/tmp/.mount_ElectrlqNuSi/usr/lib/python3.6/site-packages/electroncash/util.py", line 830, in run_with_except_hook
run_original(args2, *kwargs2)
File "/tmp/.mount_ElectrlqNuSi/usr/lib/python3.6/site-packages/electroncash_plugins/fusion/fusion.py", line 478, in run
traceback.print_exc(file=sys.stderr)
File "/tmp/.mount_ElectrlqNuSi/usr/lib/python3.6/traceback.py", line 163, in print_exc
print_exception(*sys.exc_info(), limit=limit, file=file, chain=chain)
File "/tmp/.mount_ElectrlqNuSi/usr/lib/python3.6/traceback.py", line 105, in print_exception
print(line, file=file, end="")

OSError: [Errno 5] Error de entrada/salida
```

~ _With robotic wishes_

Was this page helpful?
0 / 5 - 0 ratings

Related issues

molecular picture molecular  路  5Comments

ProfessorVenkman picture ProfessorVenkman  路  4Comments

imaginaryusername picture imaginaryusername  路  6Comments

imaginaryusername picture imaginaryusername  路  5Comments

jcramer picture jcramer  路  4Comments