Skip to content

Commit

Permalink
Merge commit '4d10eb0fb64bb033c950a8b6a63c6fae25fe4373' into feature/…
Browse files Browse the repository at this point in the history
…tls_parameter_extension
  • Loading branch information
stepanLav committed Jul 7, 2021
2 parents c0a53ef + 4d10eb0 commit 55e0f45
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion iroha/iroha.py
Original file line number Diff line number Diff line change
Expand Up @@ -448,10 +448,25 @@ def tx_status_stream(self, transaction, timeout=None):
integral status code, and error code (will be 0 if no error occurred)
:raise: grpc.RpcError with .code() available in case of any error
"""
tx_hash = IrohaCrypto.hash(transaction)
yield from self.tx_hash_status_stream(tx_hash, timeout)

def tx_hash_status_stream(self, transaction_hash: "str or bytes", timeout=None):
"""
Generator of transaction statuses from status stream
:param transaction_hash: the hash of transaction, which status is about to be known
:param timeout: timeout for network I/O operations in seconds
:return: an iterable over a series of tuples with symbolic status description,
integral status code, and error code (will be 0 if no error occurred)
:raise: grpc.RpcError with .code() available in case of any error
"""
if not timeout:
timeout = self._timeout
request = endpoint_pb2.TxStatusRequest()
request.tx_hash = binascii.hexlify(IrohaCrypto.hash(transaction))
if isinstance(transaction_hash, bytes):
request.tx_hash = binascii.hexlify(transaction_hash)
else:
request.tx_hash = transaction_hash.encode('utf-8')
response = self._command_service_stub.StatusStream(
request, timeout=timeout)
for status in response:
Expand Down

0 comments on commit 55e0f45

Please sign in to comment.