Skip to content

Commit fd6a114

Browse files
yxqvipwzw
yxq
authored andcommitted
fix: index bug
1 parent 973e1a0 commit fd6a114

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

system/p2p/dht/protocol/p2pstore/handler.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ func (p *Protocol) handleEventNotifyStoreChunk(m *queue.Message) {
398398
//如果本节点是扩展路由表中距离该chunk最近的 `Percentage` 节点之一,则保存数据;否则不需要保存数据
399399
extendRoutingTable := p.getExtendRoutingTable()
400400
pids := extendRoutingTable.NearestPeers(genDHTID(req.ChunkHash), extendRoutingTable.Size())
401-
if len(pids) > 0 && kb.Closer(pids[len(pids)*p.SubConfig.Percentage/100], p.Host.ID(), genChunkNameSpaceKey(req.ChunkHash)) {
401+
if len(pids) > 0 && kb.Closer(pids[(len(pids)-1)*p.SubConfig.Percentage/100], p.Host.ID(), genChunkNameSpaceKey(req.ChunkHash)) {
402402
return
403403
}
404404
log.Info("handleEventNotifyStoreChunk", "peers count", len(pids), "chunk hash", hex.EncodeToString(req.ChunkHash), "start", req.Start, "end", req.End)

0 commit comments

Comments
 (0)