Repository: Chia-Network/chia-blockchain

Issue:
[Bug] farmer-only connect to incorrect full node host
### What happened?

Hi on 2.0.0 when calling chia farm summary, it connect to incorrect host.

My setup is
```
harvester machine ---> farmer-only vps (docker) ----> full_node vps (docker)
```

Using config from https://github.com/Chia-Network/chia-blockchain/blob/main/chia/util/initial-config.yaml

I set the ```farmer.full_node_peer``` to **full_node vps ip**, the rest of host is to 127.0.0.1 ("localhost" doesn't work inside docker), but somehow it still call 127.0.0.1 instead of **full_node vps ip**.

Also while Farmer produce correct log, but in pool it's not detecting the space ( reduce to 0 )

Log according to [wiki](https://github.com/Chia-Network/chia-blockchain/wiki/Farming-on-many-machines) , currently the last one does not appear in the log
```
[time stamp] farmer farmer_server   : DEBUG   -> new_signage_point_harvester to peer [harvester IP address] [peer id - 64 char hexadecimal]
[time stamp] farmer farmer_server   : DEBUG   <- farming_info from peer [peer id - 64 char hexadecimal] [harvester IP address]
[time stamp] farmer farmer_server   : DEBUG   <- new_proof_of_space from peer [peer id - 64 char hexadecimal] [harvester IP address]
```
been using this setup since 1.6

All chia version already bump to 2.0.0
node is full synced 
```
Network: mainnet    Port: 8444   RPC Port: 8555
Node ID: XXX
Genesis Challenge: XXX
Current Blockchain Status: Full Node Synced

Peak: Hash: 12bf79ecf46def4e451601362e8bd0ae1f1fa568c10396c3ae3deafeb96572c7
      Time: Fri Aug 25 2023 16:53:08 UTC                  Height:    4137661

Estimated network space: 27.576 EiB
Current difficulty: 2544
Current VDF sub_slot_iters: XXX

  Height: |   Hash:
  4137661 | 12bf79ecf46def4e451601362e8bd0ae1f1fa568c10396c3ae3deafeb96572c7
  4137660 | a77c82b0f3a4f0ff38c84b3fe5d2e362a2b5dbbcde908967f7d2b6c5e6bae912
  4137659 | 11c9d54474e4fbb3027095b66b106c731bb5d558acd1771ded0a50afc4745c39
  4137658 | 45fd001416af7bf435d0e6c6d7b27bdde35c7f639c5051fb76659129112c77d5
  4137657 | 02a09cc61390923efd6e7c04676949aa5b4f04fe8e2437096f91df78c1b9a769
  4137656 | 87275fda25331adec1013b56a49b0f85de22e128b4db2f6cdbfbf355219cb39d
  4137655 | 153c07b6064bbc4f3d2e3ae105528b98d6b1e500592b74695cd00f90bd912f08
  4137654 | 0bbbb60804f7545df58379d3cbef8862a9f82c7ef9cf90650f634df9e4a08e73
  4137653 | be53927fb9b97c54643860fdb065097ce83d83525aadade2e4769cbe75a4ed19
  4137652 | 3f629552e56732018d9ec7a0aa0f2614dd4460963ed42f60c2189d1be98e788b

```

plot are normal k32 plot, no compression. Any tweak require for harvester ?

### Version

2.0.0

### What platform are you using?

Linux

### What ui mode are you using?

CLI

### Relevant log output

```shell
Error: Connection error: ClientConnectorError: Cannot connect to host 127.0.0.1:8555 ssl:<ssl.SSLContext object at 0x7f6a078b8340> [Connect call failed ('127.0.0.1', 8555)]
Check if full node rpc is running at 8555
This is normal if full node is still starting up
```



Discussion:
When updating to 2.0.0 did you have a new config created for each device and also run the `chia init [directory]` command on each harvester?

More info: https://github.com/Chia-Network/chia-blockchain/wiki/Farming-on-many-machines#setup-steps
> When updating to 2.0.0 did you have a new config created for each device and also run the `chia init [directory]` command on each harvester?
> 
> More info: https://github.com/Chia-Network/chia-blockchain/wiki/Farming-on-many-machines#setup-steps

I stop the service remove all the previous config and use the config-init.yml from the source code for **farmer-only** and **full node** service.
Then I update the value I use from previous config ( log related and farmer.full_node_peer ) and restart.

From the error it's looks like the farmer not connecting to the correct full node. 
I didn't update the harvester config, it looks the same for harvester. 

I will need to test on specific pc, is there a public full node available for testing ?
This is basically a duplicate of https://github.com/Chia-Network/chia-blockchain/issues/9615

The behavior is slightly worse now, but the basic issue is the same. Closing as duplicate.

Resolving patch:
diff --git a/chia/cmds/farm_funcs.py b/chia/cmds/farm_funcs.py
--- a/chia/cmds/farm_funcs.py
+++ b/chia/cmds/farm_funcs.py
@@ -1,5 +1,7 @@
 from __future__ import annotations
 
+import sys
+import traceback
 from pathlib import Path
 from typing import Any, Dict, List, Optional
 
@@ -10,6 +12,7 @@
 from chia.rpc.full_node_rpc_client import FullNodeRpcClient
 from chia.rpc.wallet_rpc_client import WalletRpcClient
 from chia.util.default_root import DEFAULT_ROOT_PATH
+from chia.util.errors import CliRpcConnectionError
 from chia.util.misc import format_bytes, format_minutes
 from chia.util.network import is_localhost
 
@@ -89,15 +92,26 @@ async def summary(
     root_path: Path = DEFAULT_ROOT_PATH,
 ) -> None:
     harvesters_summary = await get_harvesters_summary(farmer_rpc_port, root_path)
-    blockchain_state = await get_blockchain_state(rpc_port, root_path)
+    blockchain_state = None
+    try:
+        blockchain_state = await get_blockchain_state(rpc_port, root_path)
+    except CliRpcConnectionError:
+        pass
+    except Exception:
+        print("Error while trying to get blockchain state!", file=sys.stderr)
+        traceback.print_exc(file=sys.stderr)
+
     farmer_running = False if harvesters_summary is None else True  # harvesters uses farmer rpc too
 
     wallet_not_ready: bool = False
     amounts = None
     try:
         amounts = await get_wallets_stats(wallet_rpc_port, root_path)
-    except Exception:
+    except CliRpcConnectionError:
         wallet_not_ready = True
+    except Exception:
+        print("Error while trying to get wallet stats!", file=sys.stderr)
+        traceback.print_exc(file=sys.stderr)
     wallet_not_running: bool = True if amounts is None else False
 
     print("Farming status: ", end="")


Test patch: