mirror of
https://github.com/Chia-Network/chia-blockchain.git
synced 2024-12-01 20:05:43 +03:00
Fix rpc for setting farming addresses
This commit is contained in:
parent
f5af3eef76
commit
783a8c65eb
@ -160,11 +160,11 @@ class Farmer:
|
||||
if farmer_target_encoded is not None:
|
||||
self.farmer_target_encoded = farmer_target_encoded
|
||||
self.farmer_target = decode_puzzle_hash(farmer_target_encoded)
|
||||
config["farmer"]["farmer_target"] = farmer_target_encoded
|
||||
config["farmer"]["xch_target_address"] = farmer_target_encoded
|
||||
if pool_target_encoded is not None:
|
||||
self.pool_target_encoded = pool_target_encoded
|
||||
self.pool_target = decode_puzzle_hash(pool_target_encoded)
|
||||
config["farmer"]["pool_target"] = pool_target_encoded
|
||||
config["pool"]["xch_target_address"] = pool_target_encoded
|
||||
save_config(self._root_path, "config.yaml", config)
|
||||
|
||||
async def _periodically_clear_cache_task(self):
|
||||
|
@ -15,6 +15,7 @@ from src.rpc.rpc_server import start_rpc_server
|
||||
from src.types.blockchain_format.sized_bytes import bytes32
|
||||
from src.util.bech32m import decode_puzzle_hash, encode_puzzle_hash
|
||||
from src.util.block_tools import get_plot_dir
|
||||
from src.util.config import load_config
|
||||
from src.util.hash import std_hash
|
||||
from src.util.ints import uint8, uint16, uint32, uint64
|
||||
from src.wallet.derive_keys import master_sk_to_wallet_sk
|
||||
@ -203,6 +204,11 @@ class TestRpc:
|
||||
assert decode_puzzle_hash(targets_4["pool_target"]) == new_ph_3
|
||||
assert not targets_4["have_pool_sk"] and targets_3["have_farmer_sk"]
|
||||
|
||||
root_path = farmer_api.farmer._root_path
|
||||
config = load_config(root_path, "config.yaml")
|
||||
assert config["farmer"]["xch_target_address"] == encode_puzzle_hash(new_ph, "xch")
|
||||
assert config["pool"]["xch_target_address"] == encode_puzzle_hash(new_ph_3, "xch")
|
||||
|
||||
new_ph_3_encoded = encode_puzzle_hash(new_ph_3, "xch")
|
||||
added_char = new_ph_3_encoded + "a"
|
||||
with pytest.raises(ValueError):
|
||||
|
Loading…
Reference in New Issue
Block a user