Skip to content

Instantly share code, notes, and snippets.

@igor-egorov
Created February 14, 2019 17:11
Show Gist options
  • Save igor-egorov/ff56db9ca1de50215d6830f5980155d6 to your computer and use it in GitHub Desktop.
Save igor-egorov/ff56db9ca1de50215d6830f5980155d6 to your computer and use it in GitHub Desktop.
Iroha replay test repro
#!/usr/bin/env python3
#
# Copyright Soramitsu Co., Ltd. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
#
import sys
if sys.version_info[0] < 3:
raise Exception('Python 3 or a more recent version is required.')
from iroha import Iroha, IrohaGrpc
from iroha import IrohaCrypto
import binascii
admin_private_key = 'f101537e319568c765b2cc89698325604991dca57b9716b58016b253506cab70'
user_private_key = IrohaCrypto.private_key()
user_public_key = IrohaCrypto.derive_public_key(user_private_key)
iroha = Iroha('admin@test')
net = IrohaGrpc()
def create_asset():
commands = [
iroha.command('CreateAsset', asset_name='coinjsdfsff',
domain_id='test', precision=2)
]
tx = IrohaCrypto.sign_transaction(
iroha.transaction(commands), admin_private_key)
net.send_tx(tx)
tx_status = 'NOT_RECEIVED'
while tx_status not in ['COMMITTED', 'REJECTED']:
for status in net.tx_status_stream(tx):
tx_status = status[0]
print(status)
if tx_status in ['COMMITTED', 'REJECTED']:
break
print('resub')
net.send_tx(tx)
net.send_tx(tx)
net.send_tx(tx)
create_asset()
print('done')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment