chainside / btcpy

A Python3 SegWit-compliant library which provides tools to handle Bitcoin data structures in a simple fashion.
https://www.chainside.net
GNU Lesser General Public License v3.0
270 stars 73 forks source link

TestTransaction fails #12

Closed l0rb closed 6 years ago

l0rb commented 6 years ago

On a fresh clone of the repository running python3 unit.py TestTransaction fails with the following Error:

Traceback (most recent call last): File "unit.py", line 190, in test_txid self.assertEqual(Transaction.unhexlify(data['raw']).txid, data['txid']) File "/home/lorb/.local/lib/python3.5/site-packages/btcpy/structs/transaction.py", line 333, in unhexlify return cls.deserialize(bytearray(unhexlify(string))) File "/home/lorb/.local/lib/python3.5/site-packages/btcpy/structs/transaction.py", line 338, in deserialize result = parser.get_next_tx(cls is MutableTransaction) File "/home/lorb/.local/lib/python3.5/site-packages/btcpy/lib/parsing.py", line 232, in get_next_tx result = Transaction(version, txins, txouts, locktime) File "/home/lorb/.local/lib/python3.5/site-packages/btcpy/structs/transaction.py", line 360, in __init__ if txid != self.txid and txid is not None: File "/home/lorb/.local/lib/python3.5/site-packages/btcpy/structs/transaction.py", line 378, in txid return self.hash() File "/home/lorb/.local/lib/python3.5/site-packages/btcpy/lib/types.py", line 26, in wrapper object.__setattr__(self, cache, method(self)) File "/home/lorb/.local/lib/python3.5/site-packages/btcpy/structs/transaction.py", line 374, in hash return hexlify(stream.hash()[::-1]).decode() AttributeError: 'Stream' object has no attribute 'hash'

This is with Python 3.5.3

SimoneBronzini commented 6 years ago

Thanks for your feedback. This is quite strange, as you can see here, the hash method was removed from Stream and replaced everywhere it was used. On the current version (tag 0.2.4) tests are running fine. How did you get your version of the codebase? Did you clone this repo or downloaded it from pypi?

l0rb commented 6 years ago

This is with the code from pypi. Edit: Can confirm that this is a problem with the pypi version. Just installed from this repo and the tests ran through fine.

SimoneBronzini commented 6 years ago

New version on pypi coming

SimoneBronzini commented 6 years ago

New version released. Please let me know if there are other problems.