Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix coins with coinbase/generation like transactions #570

Closed
erasmospunk opened this issue Aug 13, 2018 · 3 comments

Comments

@erasmospunk
Copy link
Contributor

commented Aug 13, 2018

There are coins like PIVX, Decred, Zcoin that use generation outpoints (hash=ZERO, idx=MINUS_1) in normal transactions.

In block processing this creates an issue with spending UTXOs but it is not noticed as those transactions are the same as generation transactions.

In recent versions of ElectrumX those generation-like transactions crash the mempool processor.

@kyuupichan

This comment has been minimized.

Copy link
Owner

commented Aug 13, 2018

What do you mean "crash"? Do you have a log?

@erasmospunk

This comment has been minimized.

Copy link
Contributor Author

commented Aug 13, 2018

Here are some logs:

ERROR:TaskGroup:task crashed: <Task finished coro=<MemPool._refresh_hashes() done, defined at /coinomi/electrumx/electrumx/server/mempool.py:130> exception=error('ushort format requires 0 <= number <= (0x7fff * 2 + 1)',)>
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/aiorpcx/util.py", line 118, in check_task
    task.result()
  File "/usr/local/lib/python3.6/dist-packages/aiorpcx/util.py", line 118, in check_task
    task.result()
  File "/coinomi/electrumx/electrumx/server/mempool.py", line 140, in _refresh_hashes
    touched = await self._process_mempool(hashes)
  File "/coinomi/electrumx/electrumx/server/mempool.py", line 175, in _process_mempool
    deferred, unspent = task.result()
  File "/usr/local/lib/python3.6/dist-packages/aiorpcx/util.py", line 118, in check_task
    task.result()
  File "/usr/local/lib/python3.6/dist-packages/aiorpcx/util.py", line 118, in check_task
    task.result()
  File "/coinomi/electrumx/electrumx/server/mempool.py", line 228, in _fetch_and_accept
    utxos = await self.lookup_utxos(prevouts)
  File "/coinomi/electrumx/electrumx/server/db.py", line 447, in lookup_utxos
    hashX_pairs = await run_in_thread(lookup_hashXs)
  File "/usr/local/lib/python3.6/dist-packages/aiorpcx/curio.py", line 60, in run_in_thread
    return await get_event_loop().run_in_executor(None, func, *args)
  File "/usr/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/coinomi/electrumx/electrumx/server/db.py", line 426, in lookup_hashXs
    return [lookup_hashX(*prevout) for prevout in prevouts]
  File "/coinomi/electrumx/electrumx/server/db.py", line 426, in <listcomp>
    return [lookup_hashX(*prevout) for prevout in prevouts]
  File "/coinomi/electrumx/electrumx/server/db.py", line 412, in lookup_hashX
    idx_packed = pack('<H', tx_idx)
struct.error: ushort format requires 0 <= number <= (0x7fff * 2 + 1)
@kyuupichan

This comment has been minimized.

Copy link
Owner

commented Aug 13, 2018

Yes the assumption is that the prevouts can be looked up to determine the fee... not sure how you intend to address that.

Separately the exception is raised because -1 is out of range...

@kyuupichan kyuupichan added the altcoin label Aug 13, 2018

erasmospunk added a commit to erasmospunk/electrumx that referenced this issue Aug 14, 2018

erasmospunk added a commit to erasmospunk/electrumx that referenced this issue Aug 15, 2018

erasmospunk added a commit to erasmospunk/electrumx that referenced this issue Aug 16, 2018

erasmospunk added a commit to erasmospunk/electrumx that referenced this issue Aug 16, 2018

shyba added a commit to lbryio/electrumx that referenced this issue Oct 16, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.