Ejemplo n.º 1
0
def does_interchain_exist(blockchain: str, name: str) -> bool:
    """Check if a specific interchain exists
    Args:
        blockchain: the blockchain of the desired client (i.e. bitcoin, ethereum, etc)
        name: the name (id) of the network to get (user defined on the creation of the interchain)
    """
    if blockchain == "bitcoin":
        return storage.does_object_exist(f"{FOLDER}/bitcoin/{name}")
    elif blockchain == "ethereum":
        return storage.does_object_exist(f"{FOLDER}/ethereum/{name}")
    else:
        return False
Ejemplo n.º 2
0
def sanity_check_empty_chain() -> None:
    """Checks that no blocks exist in storage

    This is for sanity checking to ensure that we don't start overwriting
    blocks if an earlier call for previous block failed. Does not return,
    just throws exceptions if Block 1 already exists (or an if an error
    occurs while checking)
    """
    if storage.does_object_exist("BLOCK/1"):
        raise exceptions.SanityCheckFailure("Block 1 already exists!")
Ejemplo n.º 3
0
def contract_does_exist(contract_id: str) -> bool:
    """Checks if a contract exists or not"""
    return storage.does_object_exist(f"{FOLDER}/{contract_id}/metadata.json")
Ejemplo n.º 4
0
 def test_does_object_exist_calls_storage_does_object_exist_with_params(
         self):
     storage.does_object_exist("prefix")
     storage.storage.does_object_exist.assert_called_once_with(
         "test", "prefix")