1

I daily have to remove 5-15 peers that's constantly delivering stale data. I have to manually remove them with admin.removepeer() by using their enode address. Unfortunately, the go-ethereum logs only show the peer id's and not their enode address which means I have to run the admin.peers command and manually scan a large list of peers to find the corresponding enode address, which is oc both time-consuming and cumbersome. Is there a simpler way to remove bad peers for ex. with their id or something? I guess I could make a script to do it for me but I wanted to know if there's something available already that I've overlooked.

-TIA

1 Answer 1

1

In the Geth JavaScript Console type:

var _remPeerById = function(id){admin.removePeer(admin.peers.filter(x=>id===id)[0].enode)};

Now you can remove peers from the console using the peer ID only by calling the new _remPeerByID function with a peer ID like so (the peer id used here is only an example, replace with the ID of the peer you wish to remove):

_remPeerById("59e10c2c9a68c326511236381b84c9ec52e72ad732eb0b2")

, which will return undefined if success or an error if not found.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.