Raise error on too small network

This commit is contained in:
danielSanchezQ 2025-07-10 14:35:30 +00:00
parent c7c5750b92
commit 9098d0c11f

View File

@ -134,6 +134,8 @@ def calculate_subnetwork_assignations(
replication_factor: int,
random_seed: bytes,
) -> Assignations:
if len(new_nodes_list) < replication_factor:
raise ValueError("The network size is smaller than the replication factor")
# The algorithm works as follows:
# 1. Remove nodes that are not active from the previous subnetworks assignations
# 2. If the network is decreasing (less available nodes than previous nodes), balance subnetworks: