Skip to content

Commit

Permalink
fix StorageData err (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
AstaFrode authored Apr 12, 2023
1 parent 513300a commit 7f2fa6b
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions core/client/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,18 +200,21 @@ func (c *Cli) StorageData(roothash string, segment []SegmentInfo, minerTaskList
return err
}

for i := 0; i < len(segment); i++ {
for j := 0; j < len(segment[i].FragmentHash); j++ {
peerid, err := c.Protocol.AddMultiaddrToPearstore(multiaddrs[i], 0)
if err != nil {
return err
}
err = c.Protocol.WriteFileAction(peerid, roothash, segment[i].FragmentHash[j])
basedir := filepath.Dir(segment[0].FragmentHash[0])
for i := 0; i < len(multiaddrs); i++ {
peerid, err := c.Protocol.AddMultiaddrToPearstore(multiaddrs[i], 0)
if err != nil {
return err
}

for j := 0; j < len(minerTaskList[i].Hash); j++ {
err = c.Protocol.WriteFileAction(peerid, roothash, filepath.Join(basedir, string(minerTaskList[i].Hash[j][:])))
if err != nil {
return err
}
}
}

return nil
}

Expand Down

0 comments on commit 7f2fa6b

Please sign in to comment.