mirror of
https://github.com/bigchaindb/bigchaindb.git
synced 2024-10-13 13:34:05 +00:00
separate call for get_status
This commit is contained in:
parent
699f2a56ef
commit
d0c38d54d8
@ -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
|
||||
|
||||
|
@ -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})
|
||||
|
Loading…
x
Reference in New Issue
Block a user