mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-23 05:06:43 +00:00
kademlia: check prox in AddNodeRecord not to try insert Self in non-existing row
This commit is contained in:
parent
30348839c1
commit
b652c9594f
1 changed files with 3 additions and 1 deletions
|
|
@ -304,10 +304,12 @@ func (self *Kademlia) AddNodeRecords(nrs []*NodeRecord) {
|
|||
if !found {
|
||||
self.nodeIndex[node.Address] = node
|
||||
index := proximity(self.addr, node.Address)
|
||||
if index < len(self.nodeDB) {
|
||||
self.nodeDB[index] = append(self.nodeDB[index], node)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
GetNodeRecord gives back a node record with the highest priority for desired
|
||||
|
|
|
|||
Loading…
Reference in a new issue