separate call for get_status

This commit is contained in:
diminator 2016-08-23 14:00:28 +02:00
parent 699f2a56ef
commit d0c38d54d8
No known key found for this signature in database
GPG Key ID: C3D8590E6D0D439A
2 changed files with 16 additions and 2 deletions

View File

@ -190,6 +190,20 @@ class Bigchain(object):
else:
return response
def get_status(self, txid):
"""Retrieve the status of a transaction with `txid` from bigchain.
Args:
txid (str): transaction id of the transaction to query
Returns:
A string transaction status to payload ('valid', 'undecided',
or 'backlog'). If no transaction with that `txid` was found it
returns `None`
"""
_, status = self.get_transaction(txid, include_status=True)
return status
def search_block_election_on_index(self, value, index):
"""Retrieve block election information given a secondary index and value

View File

@ -100,9 +100,9 @@ def get_transaction_status(tx_id):
pool = current_app.config['bigchain_pool']
with pool() as bigchain:
tx, status = bigchain.get_transaction(tx_id, include_status=True)
status = bigchain.get_status(tx_id, include_status=True)
if not tx:
if not status:
return make_error(404)
return flask.jsonify({'status': status})