def create_inconsistent_transaction(step, node):
    """
    Creates an inconsistent transaction by generating a zero value transaction that references
    a non-existent transaction as its branch and trunk, thus not connecting with any other part
    of the tangle.

    :param node: The node that the transaction will be generated on.
    """
    world.config['nodeId'] = node
    api = api_utils.prepare_api_call(node)
    trunk = static.NULL_HASH
    branch = trunk
    trytes = static.EMPTY_TRANSACTION_TRYTES

    argument_list = {
        'trunk_transaction': trunk,
        'branch_transaction': branch,
        'trytes': [trytes],
        'min_weight_magnitude': 14
    }

    transaction = transactions.attach_store_and_broadcast(api, argument_list)
    transaction_trytes = transaction.get('trytes')
    transaction_hash = Transaction.from_tryte_string(transaction_trytes[0])

    if 'inconsistentTransactions' not in world.responses:
        world.responses['inconsistentTransactions'] = {}
    world.responses['inconsistentTransactions'][node] = transaction_hash.hash
Exemple #2
0
def reference_stitch_transaction(step):
    node = world.config['nodeId']
    stitch = world.responses['previousTransaction'][node]
    referencing_address = static.REFERENCING_ADDRESS

    api = api_utils.prepare_api_call(node)

    transaction_bundle = transactions.create_transaction_bundle(
        referencing_address, 'REFERENCE9TAG', 0)
    branch = api.get_transactions_to_approve(depth=3)['branchTransaction']
    options = {
        'trunk_transaction': stitch,
        'branch_transaction': branch,
        'trytes': transaction_bundle.as_tryte_strings(),
        'min_weight_magnitude': 9
    }

    transactions.attach_store_and_broadcast(api, options)
 def make_transaction(node, arg_list):
     response = transactions.attach_store_and_broadcast(
         arg_list['api'], options)
     arg_list['responses']['attachToTangle'][node] = response
     return response