Black listing of bad peers

This commit is contained in:
obscuren
2014-10-02 17:03:48 +02:00
parent b55e017e62
commit a75c92000f
3 changed files with 123 additions and 30 deletions

View File

@ -69,6 +69,8 @@ type Ethereum struct {
Addr net.Addr
Port string
blacklist [][]byte
peerMut sync.Mutex
// Capabilities for outgoing peers
@ -211,6 +213,10 @@ func (s *Ethereum) HighestTDPeer() (td *big.Int) {
return
}
func (self *Ethereum) BlacklistPeer(peer *Peer) {
self.blacklist = append(self.blacklist, peer.pubkey)
}
func (s *Ethereum) AddPeer(conn net.Conn) {
peer := NewPeer(conn, s, true)