예제 #1
0
def store_l4_blocks(next_block_id_to_broadcast: str) -> None:
    # Gets stringified lists of L4 blocks from different L1s
    # Shape: ["{l4 block in transit}", "{l4 block in transit}"]
    _log.info("[L5] Storing L4 blocks")
    queue.check_and_recover_processing_if_necessary()
    l4_blocks = queue.get_new_l4_blocks()
    _log.info(f"[L5] Popped {len(l4_blocks)} L4 blocks off of queue")
    if l4_blocks:
        verified_records = verify_blocks(l4_blocks)
        storage.put_object_as_json(f"BROADCAST/TO_BROADCAST/{next_block_id_to_broadcast}/{str(uuid.uuid4())}", verified_records)
    # Successfully handled block popped from redis
    queue.clear_processing_queue()
예제 #2
0
def get_new_block() -> Optional["l1_block_model.L1BlockModel"]:
    # Safety check to recover after unexpected crash while creating last block if necessary
    queue.check_and_recover_processing_if_necessary()
    return queue.get_next_l1_block()
예제 #3
0
def get_new_transactions() -> List["transaction_model.TransactionModel"]:
    # Safety check to recover after unexpected crash while creating last block if necessary
    queue.check_and_recover_processing_if_necessary()
    return queue.get_new_transactions()
예제 #4
0
def get_new_blocks() -> Union[Tuple[None, None], Tuple[
    "L1Headers", List["l3_block_model.L3BlockModel"]]]:
    # Safety check to recover after unexpected crash while creating last block if necessary
    queue.check_and_recover_processing_if_necessary()
    return queue.get_next_l3_block()