Skip to content
This repository has been archived by the owner on Jul 1, 2022. It is now read-only.

Invalid transaction hash #48

Open
danionita opened this issue Oct 30, 2018 · 4 comments
Open

Invalid transaction hash #48

danionita opened this issue Oct 30, 2018 · 4 comments

Comments

@danionita
Copy link

  • bigchaindb-coalaip version: 0.0.5

  • Python version: Python 3.6.6

  • Operating System: 18.04.1 LTS (Bionic Beaver)

  • pycoalaip version: 0.0.3

  • bigchaindb-driver version: 0.6.1

Description

I was trying to use the bigchaindb-coalaip plugin to register a COALAIP WORK on a BigChainDB instance.
However, the transaction generated by the plugin has invalid hash.

What I Did

I ran the following python script.

plugin = Plugin("http://172.20.0.2:9984")
coalaip = CoalaIp(plugin)

user = coalaip.generate_user()

work_data = {'name': 'work1'}
work = coalaip.register_work(work_data, copyright_holder = user)

It threw the following error:

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/coalaip_bigchaindb/plugin.py", line 186, in save
    self.driver.transactions.send(fulfilled_tx)
  File "/usr/local/lib/python3.6/dist-packages/bigchaindb_driver/driver.py", line 319, in send
    method='POST', path=self.path, json=transaction, headers=headers)
  File "/usr/local/lib/python3.6/dist-packages/bigchaindb_driver/transport.py", line 58, in forward_request
    headers=headers,
  File "/usr/local/lib/python3.6/dist-packages/bigchaindb_driver/connection.py", line 57, in request
    raise exc_cls(response.status_code, text, json)
bigchaindb_driver.exceptions.BadRequest: (400, '{"message":"Invalid transaction (InvalidHash): The transaction\'s id \'549592207864100776fe8fdc58e7fafead2c293424a7b76140640db12b1cf375\' isn\'t equal to the hash of its body, i.e. it\'s not valid.","status":400}\n', {'message': "Invalid transaction (InvalidHash): The transaction's id '549592207864100776fe8fdc58e7fafead2c293424a7b76140640db12b1cf375' isn't equal to the hash of its body, i.e. it's not valid.", 'status': 400})

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "coalaiptest.py", line 21, in <module>
    work = coalaip.register_work(work_data, copyright_holder = user)
  File "/usr/local/lib/python3.6/dist-packages/coalaip/coalaip.py", line 64, in register_work
    work.create(copyright_holder, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/coalaip/entities.py", line 325, in create
    create_id = self.plugin.save(entity_data, user=user)
  File "/usr/local/lib/python3.6/dist-packages/coalaip_bigchaindb/utils.py", line 41, in reraises_if_not
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/coalaip_bigchaindb/plugin.py", line 188, in save
    raise EntityCreationError(error=ex) from ex
coalaip.exceptions.EntityCreationError
@TimDaub
Copy link
Contributor

TimDaub commented Oct 30, 2018

What version of BigchainDB are you using? This package is only supported until bigchaindb~=1.0.1: https://github.com/bigchaindb/pycoalaip-bigchaindb/blob/master/setup.py#L24

@danionita
Copy link
Author

Thanks for the quick reply! I am running the latest release of BigchainDB, v2.0.0b7.
Are you aware of any plans to support v2 or any alternatives for using COALAIP on BigchainDB v2?

@TimDaub
Copy link
Contributor

TimDaub commented Oct 30, 2018

@danionita
Copy link
Author

Thanks, I did.
But maybe it's a good idea to mention this compatibility issue somewhere more prominently than inside a .py file which is not even used anymore.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants