Repository: Chia-Network/chia-blockchain
File: tools/validate_rpcs.py (Python)

Code before:
    if start_height is None:
        start_height = 0
    asyncio.run(
        cli_async(
            root_path=root_path_path,
            rpc_port=rpc_port,
            spends_with_conditions=spends_with_conditions,
            block_spends=block_spends,
            additions_and_removals=additions_and_removals,
            start_height=start_height,
            end_height=end_height,
            pipeline_depth=pipeline_depth,
        )
    )


async def node_spends_with_conditions(
    node_client: FullNodeRpcClient,
    block_hash: bytes32,
    height: int,
) -> None:
    result = await node_client.get_block_spends_with_conditions(block_hash)
    if result is None:
        print(f"ERROR: [{height}] get_block_spends_with_conditions returned invalid result")


async def node_block_spends(
    node_client: FullNodeRpcClient,
    block_hash: bytes32,
    height: int,
) -> None:
    result = await node_client.get_block_spends(block_hash)
    if result is None:
        print(f"ERROR: [{height}] get_block_spends returned invalid result")


async def node_additions_removals(
    node_client: FullNodeRpcClient,
    block_hash: bytes32,
    height: int,
) -> None:
    response = await node_client.get_additions_and_removals(block_hash)
    if response is None:
        print(f"ERROR: [{height}] get_additions_and_removals returned invalid result")


async def cli_async(
    root_path: Path,
    rpc_port: Optional[int],
    spends_with_conditions: bool,
    block_spends: bool,

Review comment (suggestion):
an option, fyi

```suggestion
    except Exception:
        print(f"ERROR: [{height}] get_block_spends_with_conditions returned invalid result")
        raise
```

Code after:
    if start_height is None:
        start_height = 0
    asyncio.run(
        cli_async(
            root_path=root_path_path,
            rpc_port=rpc_port,
            spends_with_conditions=spends_with_conditions,
            block_spends=block_spends,
            additions_and_removals=additions_and_removals,
            start_height=start_height,
            end_height=end_height,
            pipeline_depth=pipeline_depth,
        )
    )


async def node_spends_with_conditions(
    node_client: FullNodeRpcClient,
    block_hash: bytes32,
    height: int,
) -> None:
    try:
        await node_client.get_block_spends_with_conditions(block_hash)
    except Exception as e:
        print(f"ERROR: [{height}] get_block_spends_with_conditions returned invalid result")
        raise e


async def node_block_spends(
    node_client: FullNodeRpcClient,
    block_hash: bytes32,
    height: int,
) -> None:
    try:
        await node_client.get_block_spends(block_hash)
    except Exception as e:
        print(f"ERROR: [{height}] get_block_spends returned invalid result")
        raise e


async def node_additions_removals(
    node_client: FullNodeRpcClient,
    block_hash: bytes32,
    height: int,
) -> None:
    try:
        await node_client.get_additions_and_removals(block_hash)
    except Exception as e:
        print(f"ERROR: [{height}] get_additions_and_removals returned invalid result")
        raise e