Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR mirrors testinprod-io#54.
Actual implementation for
admin_addPeer
method.RPC Spec: Refer to https://geth.ethereum.org/docs/interacting-with-geth/rpc/ns-admin.
Requires ledgerwatch/erigon-lib#1033
After ledgerwatch/erigon-lib#1033 is merged, will update erigon-lib version, removing replace at go.mod.
Note that even if RPC response returns
true
, it does not guarantee that RLPx protocol is established between peers. It just adds node entrypoint to its static peer list, and periodically tries and tests connections.Testing
This RPC needs integration testing, so I made some scenario.
Use below command for testing:
Spin up two dev nodes which p2p enabled:
Start Node 1: RPC running at port 8545:
Start Node 2: RPC running at port 8546:
Get nodeInfo of node 1 using
admin_nodeInfo
RPC:Example response:
Get nodeInfo of node 2 using
admin_nodeInfo
RPC:Example response:
Call
admin_addPeer
RPC to node 2:Example response:
Check peer info of node 1 using
admin_peers
RPC:Example response: