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,9 +304,11 @@ func (self *Kademlia) AddNodeRecords(nrs []*NodeRecord) {
|
||||||
if !found {
|
if !found {
|
||||||
self.nodeIndex[node.Address] = node
|
self.nodeIndex[node.Address] = node
|
||||||
index := proximity(self.addr, node.Address)
|
index := proximity(self.addr, node.Address)
|
||||||
|
if index < len(self.nodeDB) {
|
||||||
self.nodeDB[index] = append(self.nodeDB[index], node)
|
self.nodeDB[index] = append(self.nodeDB[index], node)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue