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

unban peer #253

Open
bitbandi opened this issue Jun 7, 2022 · 8 comments
Open

unban peer #253

bitbandi opened this issue Jun 7, 2022 · 8 comments

Comments

@bitbandi
Copy link

bitbandi commented Jun 7, 2022

If a peer is banned for (48hours) becase he does bad things. But somethimes bans are unfair (btc daemon misconfigure, etc). there is no possible to unban the fixed peer.

Please add some func for this. and for lnd/lncli rpc too.

@Roasbeef
Copy link
Member

Roasbeef commented Jun 7, 2022

We have a gRPC server for neutrino in version 0.15 of lnd, which IMO should actually be moved to this project, which'll allow us to easily add calls like this.

@Chinwendu20
Copy link
Contributor

plesae I would like to work on this

@lucasdcf
Copy link

lucasdcf commented Apr 4, 2023

Go ahead @Chinwendu20 !

@Chinwendu20
Copy link
Contributor

I really do not think banning a peer does anything to it, it just disconnects it and puts it in database that is not even consulted when we want to reconnect to a peer. Please let me know if I am mistaken.

@ellemouton
Copy link
Member

database that is not even consulted when we want to reconnect to a peer.

I dont think that is true. See all the calls to (*ChainService) IsBanned

@Chinwendu20
Copy link
Contributor

I don't think IsBanned has anything to do with reconnection?

neutrino/neutrino.go

Lines 1102 to 1124 in 3275e33

// IsBanned returns true if the peer is banned, and false otherwise.
func (s *ChainService) IsBanned(addr string) bool {
ipNet, err := banman.ParseIPNet(addr, nil)
if err != nil {
log.Errorf("Unable to parse IP network for peer %v: %v", addr,
err)
return false
}
banStatus, err := s.banStore.Status(ipNet)
if err != nil {
log.Errorf("Unable to determine ban status for peer %v: %v",
addr, err)
return false
}
// Log how much time left the peer will remain banned for, if any.
if time.Now().Before(banStatus.Expiration) {
log.Debugf("Peer %v is banned for another %v", addr,
time.Until(banStatus.Expiration))
}
return banStatus.Banned
}

@ellemouton
Copy link
Member

im saying look at where IsBanned is called from. There a a couple of call sites. We call this to check if we should connect to a peer or if we should disconnect from them if they connect to us

@Chinwendu20
Copy link
Contributor

Oh thanks you are totally right. I was looking at the logs and it seemed we connect to already banned peers but after following the code after you pointed it out, it seems in some cases we let the peers connect then in onconnected function disconnect them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants