Safer check for pool_list in config (#9810)
* Safer check for pool_list in config * safer pool_list check
This commit is contained in:
parent
a673bd4b61
commit
142b0c5c5b
|
@ -584,10 +584,12 @@ class Farmer:
|
|||
if launcher_id == pool_state_dict["pool_config"].launcher_id:
|
||||
config = load_config(self._root_path, "config.yaml")
|
||||
new_list = []
|
||||
for list_element in config["pool"]["pool_list"]:
|
||||
if hexstr_to_bytes(list_element["launcher_id"]) == bytes(launcher_id):
|
||||
list_element["payout_instructions"] = payout_instructions
|
||||
new_list.append(list_element)
|
||||
pool_list = config["pool"].get("pool_list", [])
|
||||
if pool_list is not None:
|
||||
for list_element in pool_list:
|
||||
if hexstr_to_bytes(list_element["launcher_id"]) == bytes(launcher_id):
|
||||
list_element["payout_instructions"] = payout_instructions
|
||||
new_list.append(list_element)
|
||||
|
||||
config["pool"]["pool_list"] = new_list
|
||||
save_config(self._root_path, "config.yaml", config)
|
||||
|
|
|
@ -41,8 +41,9 @@ class PoolWalletConfig(Streamable):
|
|||
def load_pool_config(root_path: Path) -> List[PoolWalletConfig]:
|
||||
config = load_config(root_path, "config.yaml")
|
||||
ret_list: List[PoolWalletConfig] = []
|
||||
if "pool_list" in config["pool"]:
|
||||
for pool_config_dict in config["pool"]["pool_list"]:
|
||||
pool_list = config["pool"].get("pool_list", [])
|
||||
if pool_list is not None:
|
||||
for pool_config_dict in pool_list:
|
||||
try:
|
||||
pool_config = PoolWalletConfig(
|
||||
bytes32.from_hexstr(pool_config_dict["launcher_id"]),
|
||||
|
|
Loading…
Reference in New Issue