Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

drop deprecated authentication_public_key from pool config #17959

Merged
merged 2 commits into from
May 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions chia/farmer/farmer.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from chia.daemon.keychain_proxy import KeychainProxy, connect_to_keychain_and_validate, wrap_local_keychain
from chia.plot_sync.delta import Delta
from chia.plot_sync.receiver import Receiver
from chia.pools.pool_config import PoolWalletConfig, add_auth_key, load_pool_config, update_pool_url
from chia.pools.pool_config import PoolWalletConfig, load_pool_config, update_pool_url
from chia.protocols import farmer_protocol, harvester_protocol
from chia.protocols.pool_protocol import (
AuthenticationPayload,
Expand Down Expand Up @@ -523,8 +523,6 @@ async def update_pool_state(self) -> None:
self.log.error(f"Could not find authentication sk for {p2_singleton_puzzle_hash}")
continue

add_auth_key(self._root_path, pool_config, authentication_sk.get_g1())

if p2_singleton_puzzle_hash not in self.pool_state:
self.pool_state[p2_singleton_puzzle_hash] = {
"p2_singleton_puzzle_hash": p2_singleton_puzzle_hash.hex(),
Expand Down
47 changes: 13 additions & 34 deletions chia/pools/pool_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,26 +62,6 @@ def load_pool_config(root_path: Path) -> List[PoolWalletConfig]:
return ret_list


# TODO: remove this a few versions after 1.3, since authentication_public_key is deprecated. This is here to support
# downgrading to versions older than 1.3.
def add_auth_key(root_path: Path, pool_wallet_config: PoolWalletConfig, auth_key: G1Element) -> None:
def update_auth_pub_key_for_entry(config_entry: Dict[str, Any]) -> bool:
auth_key_hex = bytes(auth_key).hex()
if config_entry.get("authentication_public_key", "") != auth_key_hex:
config_entry["authentication_public_key"] = auth_key_hex

return True

return False

update_pool_config_entry(
root_path=root_path,
pool_wallet_config=pool_wallet_config,
update_closure=update_auth_pub_key_for_entry,
update_log_message=f"Updating pool config for auth key: {auth_key}",
)


def update_pool_url(root_path: Path, pool_wallet_config: PoolWalletConfig, pool_url: str) -> None:
def update_pool_url_for_entry(config_entry: Dict[str, Any]) -> bool:
if config_entry.get("pool_url", "") != pool_url:
Expand All @@ -107,21 +87,20 @@ def update_pool_config_entry(
) -> None:
with lock_and_load_config(root_path, "config.yaml") as config:
pool_list = config["pool"].get("pool_list", [])
if pool_list is None:
return
updated = False
if pool_list is not None:
for pool_config_dict in pool_list:
try:
if hexstr_to_bytes(pool_config_dict["owner_public_key"]) == bytes(
pool_wallet_config.owner_public_key
):
if update_closure(pool_config_dict):
updated = True
except Exception as e:
log.error(f"Exception updating config: {pool_config_dict} {e}")
if updated:
log.info(update_log_message)
config["pool"]["pool_list"] = pool_list
save_config(root_path, "config.yaml", config)
for pool_config_dict in pool_list:
try:
if hexstr_to_bytes(pool_config_dict["owner_public_key"]) == bytes(pool_wallet_config.owner_public_key):
if update_closure(pool_config_dict):
updated = True
except Exception as e:
log.error(f"Exception updating config: {pool_config_dict} {e}")
if updated:
log.info(update_log_message)
config["pool"]["pool_list"] = pool_list
save_config(root_path, "config.yaml", config)


async def update_pool_config(root_path: Path, pool_config_list: List[PoolWalletConfig]) -> None:
Expand Down
Loading