dragonchain/transaction_processor/level_4_actions.py
def execute() -> None:
    """Gets the next L3 block content from the queue and processes it"""
    matchmaking.renew_registration_if_necessary()
    t0 = time.time()

    l1_headers, l3_blocks = get_new_blocks()
    if l3_blocks and l1_headers:
        _log.info(f"[L4] Got next L3 block array from dcid: {l1_headers['dc_id']} for blockid: {l1_headers['block_id']}")
        t1 = time.time()

        validations = verify_blocks(l3_blocks, l1_headers)
        t2 = time.time()

        l4_block = create_block(l1_headers, validations)
        t3 = time.time()

        send_data(l4_block)
        t4 = time.time()

        # Clear our processing queue (finished successfully)
        clear_processing_blocks()

        total = t4 - t0
        _log.info(f"[L4] Processed block l3 blocks in {total:.4f} seconds")
        _log.info(f"[L4] Retrieving L3 block from queue: {t1 - t0:.4f} sec ({((t1 - t0) / total) * 100:.1f}% of processing)")
        _log.info(f"[L4] Validating all L3 block proofs: {t2 - t1:.4f} sec ({((t2 - t1) / total) * 100:.1f}% of processing)")
        _log.info(f"[L4] Creating block with proof: {t3 - t2:.4f} sec ({((t3 - t2) / total) * 100:.1f}% of processing)")
        _log.info(f"[L4] Uploading block and broadcasting down: {t4 - t3:.4f} sec ({((t4 - t3) / total) * 100:.1f}% of processing)")

        recurse_if_necessary()
    else:
        # Clear our processing queue
        clear_processing_blocks()

    if l1_headers is not None and l3_blocks is None:
        try:
            _log.warning(f"Bad Block received from lower level. L1 Headers: {l1_headers}")
        except Exception:  # nosec (We don't care if l1_headers is an error/not defined and this log fails)
            pass

        # Clear our processing queue
        clear_processing_blocks()
Gets the next L3 block content from the queue and processes it
Gets the next L3 block content from the queue and processes it
Gets the next L3 block content from the queue and processes it
def execute() -> None:
    matchmaking.renew_registration_if_necessary()
    t0 = time.time()
    l1_headers, l3_blocks = get_new_blocks()
    if l3_blocks and l1_headers:
        _log.info(f"[L4] Got next L3 block array from dcid: {l1_headers['dc_id']} for blockid: {l1_headers['block_id']}")
        t1 = time.time()
        validations = verify_blocks(l3_blocks, l1_headers)
        t2 = time.time()
        l4_block = create_block(l1_headers, validations)
        t3 = time.time()
        send_data(l4_block)
        t4 = time.time()
        clear_processing_blocks()
        total = t4 - t0
        _log.info(f"[L4] Processed block l3 blocks in {total:.4f} seconds")
        _log.info(f"[L4] Retrieving L3 block from queue: {t1 - t0:.4f} sec ({((t1 - t0) / total) * 100:.1f}% of processing)")
        _log.info(f"[L4] Validating all L3 block proofs: {t2 - t1:.4f} sec ({((t2 - t1) / total) * 100:.1f}% of processing)")
        _log.info(f"[L4] Creating block with proof: {t3 - t2:.4f} sec ({((t3 - t2) / total) * 100:.1f}% of processing)")
        _log.info(f"[L4] Uploading block and broadcasting down: {t4 - t3:.4f} sec ({((t4 - t3) / total) * 100:.1f}% of processing)")
        recurse_if_necessary()
    else:
        clear_processing_blocks()
    if l1_headers is not None and l3_blocks is None:
        try:
            _log.warning(f"Bad Block received from lower level. L1 Headers: {l1_headers}")
        except Exception:  
            pass
        clear_processing_blocks()
def execute ( ) -> None : matchmaking . renew_registration_if_necessary ( ) t0 = time . time ( ) l1_headers , l3_blocks = get_new_blocks ( ) if l3_blocks and l1_headers : _log . info ( f"[L4] Got next L3 block array from dcid: {l1_headers['dc_id']} for blockid: {l1_headers['block_id']}" ) t1 = time . time ( ) validations = verify_blocks ( l3_blocks , l1_headers ) t2 = time . time ( ) l4_block = create_block ( l1_headers , validations ) t3 = time . time ( ) send_data ( l4_block ) t4 = time . time ( ) clear_processing_blocks ( ) total = t4 - t0 _log . info ( f"[L4] Processed block l3 blocks in {total:.4f} seconds" ) _log . info ( f"[L4] Retrieving L3 block from queue: {t1 - t0:.4f} sec ({((t1 - t0) / total) * 100:.1f}% of processing)" ) _log . info ( f"[L4] Validating all L3 block proofs: {t2 - t1:.4f} sec ({((t2 - t1) / total) * 100:.1f}% of processing)" ) _log . info ( f"[L4] Creating block with proof: {t3 - t2:.4f} sec ({((t3 - t2) / total) * 100:.1f}% of processing)" ) _log . info ( f"[L4] Uploading block and broadcasting down: {t4 - t3:.4f} sec ({((t4 - t3) / total) * 100:.1f}% of processing)" ) recurse_if_necessary ( ) else : clear_processing_blocks ( ) if l1_headers is not None and l3_blocks is None : try : _log . warning ( f"Bad Block received from lower level. L1 Headers: {l1_headers}" ) except Exception : pass clear_processing_blocks ( )
Gets the next L3 block content from the queue and processes it
Gets the next L3 block content from the queue and processes it
"""Gets the next L3 block content from the queue and processes it""" # Clear our processing queue (finished successfully) # Clear our processing queue # nosec (We don't care if l1_headers is an error/not defined and this log fails) # Clear our processing queue