aboutsummaryrefslogtreecommitdiffstats
path: root/p2p/discover/table.go
diff options
context:
space:
mode:
authorJeffrey Wilcke <jeffrey@ethereum.org>2016-05-03 19:30:51 +0800
committerJeffrey Wilcke <jeffrey@ethereum.org>2016-05-03 19:30:51 +0800
commit258cc73ea970890a5b75bf27197c3a6667f3bc5a (patch)
tree451b71e96d59d7e8a91420df90eb11dd2c4bdd87 /p2p/discover/table.go
parent79b7b5eeaad68c390f658b085eb9cfec74a3509c (diff)
parent81106719601c6eb0fa9e9421262569c16e3c2fde (diff)
downloadgo-tangerine-258cc73ea970890a5b75bf27197c3a6667f3bc5a.tar
go-tangerine-258cc73ea970890a5b75bf27197c3a6667f3bc5a.tar.gz
go-tangerine-258cc73ea970890a5b75bf27197c3a6667f3bc5a.tar.bz2
go-tangerine-258cc73ea970890a5b75bf27197c3a6667f3bc5a.tar.lz
go-tangerine-258cc73ea970890a5b75bf27197c3a6667f3bc5a.tar.xz
go-tangerine-258cc73ea970890a5b75bf27197c3a6667f3bc5a.tar.zst
go-tangerine-258cc73ea970890a5b75bf27197c3a6667f3bc5a.zip
Merge pull request #2510 from fjl/p2p-fixups
p2p/discover: prevent bonding self
Diffstat (limited to 'p2p/discover/table.go')
-rw-r--r--p2p/discover/table.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/p2p/discover/table.go b/p2p/discover/table.go
index 1de045f04..ad0b5c8ca 100644
--- a/p2p/discover/table.go
+++ b/p2p/discover/table.go
@@ -25,6 +25,7 @@ package discover
import (
"crypto/rand"
"encoding/binary"
+ "errors"
"fmt"
"net"
"sort"
@@ -457,6 +458,9 @@ func (tab *Table) bondall(nodes []*Node) (result []*Node) {
// If pinged is true, the remote node has just pinged us and one half
// of the process can be skipped.
func (tab *Table) bond(pinged bool, id NodeID, addr *net.UDPAddr, tcpPort uint16) (*Node, error) {
+ if id == tab.self.ID {
+ return nil, errors.New("is self")
+ }
// Retrieve a previously known node and any recent findnode failures
node, fails := tab.db.node(id), 0
if node != nil {