1

Running a geth full node on a dedicated server:

geth --maxpeers 5000 --light.maxpeers 2000 --light.serve 500 --syncmode full

I want to make sure it'll always accept my light client(s) even if its LES limits are reached (it should kick out some other client in that case). Conversely, while my light clients are connected, they should never be kicked out by the server.

Source code mentions a clientPool structure that maintains some priorities/counters for all known peers but I can't find a way to read the contents of it from geth console. Nor can I find a way to set the priorities manually.

I've tried whitelisting my client via admin.addTrustedPeer (executed on the server), but with no luck.

Despite the server not being currently busy serving other clients, my light client keeps getting kicked out all the time. (Note: I have a few thousands of ETH accounts watched by that light client, if that's relevant).

(Light) client log:

TRACE[02-24|19:28:08.383] Starting p2p dial                        id=abcdef123456789 ip=192.0.2.1 flag=staticdial
INFO [02-24|19:28:08.383] Looking for peers                        peercount=0 tried=1 static=1
DEBUG[02-24|19:28:08.388] Adding p2p peer                          peercount=1 id=abcdef123456789 conn=trusted-staticdial addr=192.0.2.1:30303 name=Geth/v1.9.25-stable-...
TRACE[02-24|19:28:08.388] Starting protocol les/3                  id=abcdef123456789 conn=trusted-staticdial
DEBUG[02-24|19:28:08.390] Node entered                             set=connected id=abcdef123456789 count=1
DEBUG[02-24|19:28:08.390] Saved node state                         id=abcdef123456789 state=[]
DEBUG[02-24|19:28:08.390] Node left                                set=connected id=abcdef123456789 count=0
DEBUG[02-24|19:28:08.390] Removing p2p peer                        peercount=0 id=abcdef123456789 duration=2.571ms  req=true err="disconnect requested"

Server (full node) log: (ignore the time gap; it repeats all the time...)

TRACE[02-24|18:05:55.640] Accepted connection                      addr=192.0.2.2:32932\n","stream":"stderr","time":"2021-02-24T18:05:55.640764336Z
DEBUG[02-24|18:05:55.642] Adding p2p peer                          peercount=166 id=fedcba987654321 conn=inbound addr=192.0.2.2:32932  name=Geth/v1.9.24-stable-...\n","stream":"stderr","time":"2021-02-24T18:05:55.642652501Z
TRACE[02-24|18:05:55.642] Starting protocol les/3                  id=fedcba987654321 conn=inbound\n","stream":"stderr","time":"2021-02-24T18:05:55.642660541Z
TRACE[02-24|18:05:55.642] Protocol les/3 failed                    id=fedcba987654321 conn=inbound err=\"disconnect requested\"\n","stream":"stderr","time":"2021-02-24T18:05:55.643015731Z

I can't see much in the logs, other than "disconnect requested" in both. It's not even saying which side has requested the disconnect, but I assume it was the server. The reason remains unknown, but again, I assume it is going to be related to that client score.

Interesting: when I try connecting another light client from another machine/IP, it gets in easily. If I try another from the same machine/IP, it's getting rejected as well (but I can't rule out a coincidence with certainty).

The client sits behind a NAT but otherwise there's no firewalls blocking it.

Any idea how one could manually whitelist an IP, or even better an enode (without the IP:port part as these may be dynamic, especially the port)?

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.