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

How to let geth always connect with another peer? #16735

Closed
wcw84 opened this issue May 14, 2018 · 5 comments
Closed

How to let geth always connect with another peer? #16735

wcw84 opened this issue May 14, 2018 · 5 comments

Comments

@wcw84
Copy link

wcw84 commented May 14, 2018

Geth version: 1.8.1-stable-1e67410e

My geth is always out of date,
WARN [05-14|10:24:55] Synchronisation failed, dropping peer peer=86d38ff0ff7c68b9 err="no peers available or all tried for download" [...] WARN [05-14|10:31:31] Synchronisation failed, dropping peer peer=47bfe5e2ca07d84f err=timeout

and i also have a parity running in the same LAN with my geth node, which is always up to date.
So I tried to let my geth sync with my parity by "admin.addPeer(MY PARITY)" in the geth console, and it works(I could see "Imported new chain segment" in the geth logs immediately).
And the problem is that my parity peer will be removed from the peers list of my geth node(I don't know why?), which would be out of date again until I do "admin.addPeer".
So is there anyway to let my geth ALWAYS connect with my pairty?

Any help will be appreciated.

@wcw84 wcw84 changed the title How to keep a peer in the peers list? How to let geth always connect with another peer? May 14, 2018
@ryanschneider
Copy link
Contributor

This requires #16333, or for you to add the peer to the trusted peer list via .toml config at launch.

@wcw84
Copy link
Author

wcw84 commented May 18, 2018

Hi @ryanschneider ,
I can't find the admin_addTrustedPeer in my geth node:

$ curl -X POST --data '{"jsonrpc":"2.0","method":"admin_addTrustedPeer","params":[],"id":67}' -H 'Content-Type: application/json' localhost:8545
{"jsonrpc":"2.0","id":67,"error":{"code":-32601,"message":"The method admin_addTrustedPeer does not exist/is not available"}}

I have started my geth node with admin in rpcapi option.

And I don't understand what is ".toml" config?
Thanks.

@ryanschneider
Copy link
Contributor

Sorry I should have been more clear: the PR I referenced hasn’t been merged yet. You can either compile from the PR branch or wait until it’s mergd and the next release is tagged.

The .toml config file is pretty under documented, but there’s a (possibly at this point out of date) example config here:

https://github.com/zhiyuan2007/sample-ethereum.toml

Unless you are pretty comfortable with Geth internals I think your best bet is to wait until a release with the above PR merged, as using the trusted peers option via the toml config is not documented anywhere I could except in the code.

@paulvi
Copy link

paulvi commented May 21, 2018

@wcw84 Add static-nodes.json with listed enode URL you want your geth node always try to connect to

http://ethdocs.org/en/latest/network/connecting-to-the-network.html#static-nodes-trusted-nodes-and-boot-nodes

Documentation about trusted-nodes.json is missing though.

@wcw84
Copy link
Author

wcw84 commented May 21, 2018

I have tried "admin.addPeer()" and the "static-nodes.json", they both work

@wcw84 wcw84 closed this as completed May 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants